Pep8, pyflakes and minor fixes