Be more Pythonic and Python 3.x compatible