Refactoring stage 2
Refactoring stage 3