all tests work after refactoring