refactoring stage 2