refactoring. still green
removing duplicated code. Still green!
adding tests that we should have had in the first place :(