refactoring and finished tdd