refactoring phase 2