passing tests after refactor