PEP8 and py3

Make code easier to read and more Python 3 compatible.