Code improvements

@bear Read line 37. I will merge as I know I didn't break anything.
Merge pull request #174 from mafagafo/python3

Code improvements