refactor phase 1