Additional cleanup and tests.