Some cleanup, and add back in some logging.