Refactoring phase one