Refactoring: Conditional restructuring