finished the refactor