Tidy up and add a couple more tests.