Tidied up the graphics, fixed a possible crash