Some cleanup and extra tests.