completed refactor phase 1