Updated iterator implementation.