various pep-8 cleanups; remove unsused imports; remove unused variables