Python 3 changes (still works with Python 2)