refactoring applied, and new methods with TDD inserted.