passing tests with refactor