impl Iterator
Small refactoring pulled out of work on #3266. This should make the methods a bit more flexible.