Optimizing and fixing bugs