Made python3 and PEP8 compatible