Changed order of drawing code