PEP-8, Python Zen, refactor and reduce code

On master code. (#942)