Implemented iterators (not tested).
Added a test for the iterator.