Fixed bug with display. Tidied up error handling using exceptions