Refactor.
Clean up logging.