refactoring phase 1