cleanup and more logging.