Made the drawing code more DRY