fix pep8 warnings and unused imports