Some PEP8 cleanups

Also, getting rid of unused imports and variables.