Some code refactoring

Refactor code to pep8 format