Refactoring phase 1