Final code for second code review for week 2

Ah I see ok very good, I'll work on setting up tests that allow for this more robust implementation!