Fix bug with graphics, add some comments