Small corrections and some code for testing.