Small code cleanup.
Code logic fix.
remove various unused imports.