Stage refactoring