FlatIterator was implemented
minor refactoring