Implemented error handling and a message system for the UI