refactoring is done; all tests pass