Refactoring stage 3