Refine the iterator implementation.