refactor phase 3