Staged refactoring