restructuring some of the draw code