Reworking the exception and logging.