Fixed the code so that the tests pass.