Fixed pyflakes and pep8 warnings.