diff --git a/dune/subgrid/subgrid/subgridindexstorage.hh b/dune/subgrid/subgrid/subgridindexstorage.hh
index c9993fe35de56212de0f04aeaed2042a32e796dd..c098e32f88068ea0b4bec961c1a79cfdc56715dc 100644
--- a/dune/subgrid/subgrid/subgridindexstorage.hh
+++ b/dune/subgrid/subgrid/subgridindexstorage.hh
@@ -105,8 +105,8 @@ class SubGridIndexStorageBase
         int levelSize (int codim, int level) const
         {
             unsigned int sum = 0;
-            for (size_t i=0; i<levelTypes[dim-codim][level].size(); i++)
-                sum += numEntities.find(levelTypes[dim-codim][level][i])->second.level[level];
+            for (const auto& type : levelTypes[dim-codim][level])
+                sum += numEntities.find(type)->second.level[level];
             return sum;
         }
 
@@ -114,7 +114,7 @@ class SubGridIndexStorageBase
         //! get number of entities of given type and and level
         int levelSize (GeometryType type, int level) const
         {
-            EntityCounter::const_iterator it = numEntities.find(type);
+            const auto it = numEntities.find(type);
             return (it==numEntities.end()) ? 0 : it->second.level[level];
         }
 
@@ -130,8 +130,8 @@ class SubGridIndexStorageBase
         int leafSize (int codim) const
         {
             unsigned int sum = 0;
-            for (size_t i=0; i<leafTypes[dim-codim].size(); i++)
-                sum += numEntities.find(leafTypes[dim-codim][i])->second.leaf;
+            for (const auto& type : leafTypes[dim-codim])
+                sum += numEntities.find(type)->second.leaf;
             return sum;
         }
 
@@ -139,7 +139,7 @@ class SubGridIndexStorageBase
         //! get number of entities of given type and leaf level
         int leafSize (const GeometryType& type) const
         {
-            EntityCounter::const_iterator it = numEntities.find(type);
+            const auto it = numEntities.find(type);
             return (it==numEntities.end()) ? 0 : it->second.leaf;
         }
 
@@ -167,17 +167,14 @@ class SubGridIndexStorageBase
                 levelTypes[i].resize(grid.maxLevel()+1);
             }
 
-            EntityCounter::iterator it = numEntities.begin();
-            for (; it!=numEntities.end(); ++it)
+            for (const auto& it : numEntities)
             {
-                if (it->second.leaf > 0)
-                    leafTypes[it->first.dim()].push_back(it->first);
+                if (it.second.leaf > 0)
+                    leafTypes[it.first.dim()].push_back(it.first);
 
-                for (size_t level=0; level<it->second.level.size(); ++level)
-                {
-                    if (it->second.level[level] > 0)
-                        levelTypes[it->first.dim()][level].push_back(it->first);
-                }
+                for (size_t level=0; level < it.second.level.size(); ++level)
+                    if (it.second.level[level] > 0)
+                        levelTypes[it.first.dim()][level].push_back(it.first);
             }
         }
 
@@ -186,14 +183,14 @@ class SubGridIndexStorageBase
         MultilevelCounter& getGeometryTypeCountForLevel(const GeometryType& gt, int level DUNE_UNUSED)
         {
             // Is this the first time we see this kind of entity?
-            EntityCounter::iterator countIt = numEntities.find(gt);
-            if (countIt==numEntities.end())
+            auto countIt = numEntities.find(gt);
+            if (countIt == numEntities.end())
             {
                 MultilevelCounter newGeometryType;
                 newGeometryType.leaf = 0;
                 newGeometryType.level.resize(grid.maxLevel()+1, 0);
 
-                std::pair<EntityCounter::iterator, bool> p = numEntities.insert(std::make_pair(gt, newGeometryType));
+                auto p = numEntities.insert(std::make_pair(gt, newGeometryType));
                 return p.first->second;
             }
             return countIt->second;
@@ -608,7 +605,7 @@ class SubGridMapIndexStorage :
 
         //! \todo Please doc me !
         SubGridMapIndexStorage (const GridType& _grid) :
-            SubGridIndexStorageBase<GridType> (_grid)
+            Base(_grid)
         {}
 
 
@@ -651,7 +648,7 @@ class SubGridMapIndexStorage :
         bool isLeaf(const GridEntity<codim>& e) const
         {
             HostIdType id = grid.globalIdSet().id(e);
-            typename GlobalToIndexMap::const_iterator it = indices[codim].find(id);
+            const auto it = indices[codim].find(id);
             if (it == indices[codim].end())
                 return false;
             return it->second.isLeafOnLevel(e.level());
@@ -663,7 +660,7 @@ class SubGridMapIndexStorage :
         bool isLeaf(const typename HostGridType::template Codim<codim>::Entity& e) const
         {
             HostIdType id = hostgrid.globalIdSet().id(e);
-            typename GlobalToIndexMap::const_iterator it = indices[codim].find(id);
+            const auto it = indices[codim].find(id);
             if (it == indices[codim].end())
                 return false;
             return it->second.isLeafOnLevel(e.level());
@@ -675,7 +672,7 @@ class SubGridMapIndexStorage :
         int levelIndex(const GridEntity<codim>& e, int level) const
         {
             HostIdType id = grid.globalIdSet().id(e);
-            typename GlobalToIndexMap::const_iterator it = indices[codim].find(id);
+            const auto it = indices[codim].find(id);
             if (it == indices[codim].end())
                 return -1;
             return it->second.getLevelIndex(level);
@@ -690,7 +687,7 @@ class SubGridMapIndexStorage :
             Hybrid::ifElse(Std::bool_constant<cc==0>(),[&](auto id)
             {
                 HostIdType hid = this->grid.globalIdSet().subId(e, i, codim);
-                typename GlobalToIndexMap::const_iterator it = indices[codim].find(hid);
+                const auto it = indices[codim].find(hid);
                 if (it != indices[codim].end())
                     result = it->second.getLevelIndex(level);
             });
@@ -708,7 +705,7 @@ class SubGridMapIndexStorage :
         int leafIndex(const GridEntity<codim>& e) const
         {
             HostIdType id = grid.globalIdSet().id(e);
-            typename GlobalToIndexMap::const_iterator it = indices[codim].find(id);
+            const auto it = indices[codim].find(id);
             if (it == indices[codim].end())
                 return -1;
             return it->second.leaf;
@@ -723,7 +720,7 @@ class SubGridMapIndexStorage :
             Hybrid::ifElse(Std::bool_constant<cc==0>(),[&](auto id)
             {
                 HostIdType hid = this->grid.globalIdSet().subId(e, i, codim);
-                typename GlobalToIndexMap::const_iterator it = indices[codim].find(hid);
+                const auto it = indices[codim].find(hid);
                 if (it == indices[codim].end())
                     result = it->second.leaf;
             });
@@ -1018,10 +1015,6 @@ class SubGridVectorIndexStorage :
         //! \todo Please doc me !
         void update()
         {
-
-            typedef typename GridType::LevelGridView LevelGridView;
-            typedef typename GridType::template Codim<0>::LevelIterator LevelIterator;
-
             numEntities.clear();
 
             levelIndices.clear();
@@ -1044,49 +1037,38 @@ class SubGridVectorIndexStorage :
                 for (int codim=0; codim<=dim; ++codim)
                 {
                     const auto& types = hostgrid.levelIndexSet(level).types(codim);
-                    auto it = types.begin();
-                    auto end = types.end();
-
-                    for (; it!=end; ++it)
+                    for (const auto& type : types)
                     {
-                        int gtIndex = GlobalGeometryTypeIndex::index(*it);
+                        int gtIndex = GlobalGeometryTypeIndex::index(type);
 
-                        levelIndices[level][gtIndex].resize(hostgrid.size(level, *it), uninitializedValue);
-                        leafIndices[level][gtIndex].resize(hostgrid.size(level, *it), uninitializedValue);
+                        levelIndices[level][gtIndex].resize(hostgrid.size(level, type), uninitializedValue);
+                        leafIndices[level][gtIndex].resize(hostgrid.size(level, type), uninitializedValue);
                     }
                 }
 
-                // insert entities
-                LevelGridView levelGridView = grid.levelGridView(level);
-                LevelIterator it = levelGridView.template begin<0>();
-                LevelIterator end = levelGridView.template end<0>();
+                // insert elements
+                const auto& levelGridView = grid.levelGridView(level);
                 if (level==grid.maxLevel())
                 {
-                    for(; it!=end; ++it)
-                        insert(*it, true, level);
+                    for(const auto& element  : elements(levelGridView))
+                        insert(element, true, level);
                 }
                 else
                 {
-                    for(; it!=end; ++it)
+                    for(const auto& element: elements(levelGridView))
                     {
-                        if (it->hbegin(level+1)==it->hend(level+1))
-                            insert(*it, true, level);
+                        if (element.hbegin(level+1)==element.hend(level+1))
+                            insert(element, true, level);
                         else
-                            insert(*it, false, level);
+                            insert(element, false, level);
                     }
                 }
 
                 // now we build the rest of the real level indices
                 for (int codim=0; codim<=dim; ++codim)
                 {
-
-                    const auto& types = hostgrid.levelIndexSet(level).types(codim);
-                    auto it = types.begin();
-                    auto end = types.end();
-
-                    for (; it!=end; ++it)
+                    for (const auto& gt : hostgrid.levelIndexSet(level).types(codim))
                     {
-                        const GeometryType& gt = *it;
                         int gtIndex = GlobalGeometryTypeIndex::index(gt);
 
                         MultilevelCounter &count = this->getGeometryTypeCountForLevel(gt, level);
@@ -1114,22 +1096,22 @@ class SubGridVectorIndexStorage :
 
                         std::vector<int>& gtLevelIndices = levelIndices[level][gtIndex];
 
+                        // new leaf indices start after the copy leaf indices
                         int newLeafCounter = counter.copyLeafCount;
+                        // the non-leaf indices start after the new leaf indices
                         int nonLeafCounter = counter.leafCount;
-                        for (size_t i=0; i<gtLevelIndices.size(); ++i)
+                        // copy leaf indices were already set in the helper function
+                        for (auto& gtLevelIndex : gtLevelIndices)
                         {
-                            if (indexContained(gtLevelIndices[i]))
+                            if (indexContained(gtLevelIndex))
                             {
                                 ++count.level[level];
-                                if (gtLevelIndices[i] == visitedValue)
-                                    gtLevelIndices[i] = nonLeafCounter++;
-                                else
+                                if (gtLevelIndex == visitedValue)
+                                    gtLevelIndex = nonLeafCounter++;
+                                else if (gtLevelIndex == hasLeafIndexValue)
                                 {
-                                    if (gtLevelIndices[i] == hasLeafIndexValue)
-                                    {
-                                        gtLevelIndices[i] = newLeafCounter++;
-                                        ++count.leaf;
-                                    }
+                                    gtLevelIndex = newLeafCounter++;
+                                    ++count.leaf;
                                 }
                             }
                         }
@@ -1237,14 +1219,8 @@ class SubGridVectorIndexStorage :
             for (int level=0; level<=grid.maxLevel(); ++level)
             {
                 for (int codim=0; codim<=dim; ++codim)
-                {
-                    const auto& types =  hostgrid.levelIndexSet(level).types(codim);
-                    auto it = types.begin();
-                    auto end = types.end();
-
-                    for (; it!=end; ++it)
-                        report(level, *it);
-                }
+                    for (const auto& type : hostgrid.levelIndexSet(level).types(codim))
+                        report(level, type);
                 std::cout << std::setfill('-') << std::setw(112) << "" << std::setfill(' ') << std::endl;
             }
             return;