Working now. Time to clean up the code and the tests.