Cleanups and tests.