refactored with TDD