PEP8 style fixes and small code cleanups