refactoring phase 3