refactor to TDD style