Improve logging.
Code cleanup.