modified iterator.py