Updated logging and code cleanup.
Code cleanup