changed graphicsChanged boolean to a function