add iterator pattern and some comments