pep8 and pyflakes applied

I applied PEP8 to most places where deviations did not seem necessary.