TODOs have been implemented and all the tests pass