Code cleanup in preparation for testing.