More cleanup, done now and ready for testing.