Logging improved. Unused imports and vars fixed