add some comments
make iterator more elegant and readable