Improved the error-handling with new messages and Exception subclasses.