add most of the drawing code to the cache