Minor fixes made based on pyflakes, pylint and pep8