Applying Test-Driven Development and Refactoring