finish the refactor