Simplify NestedIterators detector

This PR depends on #309.