Refactor code for nested stmts in policy std