Optimized some drawing code in the run loop.