Bit more error checking and more tests.