Implemented error logging.