Use explicit integer division to avoid getting a float list index in Python 3
Fix iterator to use 'next' and '__next__' in a way that works in Py3K