Minor cleanup and sanity tests.