Duplicated import removed. pep8 code.
Some long lines refactored.