implemented the iterator