Improved exception handling / logging.