Refactoring stage 1