pep8 based style cleanups

Mostly pep cleanups, also added some missing imports