Refactor of drawing routine.