Refactoring nightmare