Major cleanup and all tests working