Split up the drawing code into a set of smaller functions and also