Fixed major bug! Game now waits for repaint to be exectued before continuing.