refactoring stage 1