Reorganising the graphics code a bit