refactoring, moving the actual iteration in the iterator