Remove unused imports, variables and PEP8 changes