tests pass after refactoring completed