Optimizing and cleaning up