Using an iterator interface