refactoring stage