Fixing pyflakes and pep8 issues