refactoring: fixed pep8 and pyflakes warnings.