Simplify the code in target_scope