Cleanup, a few things work nicer, and some tests.