Added custom error/output logging.