Changed all the calls to getGraphics to create graphics where applicable