Simplified the error handling and made the errors visible to the user.