Another attempt at fixing the drawing code.