Small changes to conform with pep8
Conform with pep8 and fix wrong imports
Improve python 3 compatibiity