refactor, all tests green