diff --git a/src/blockforest/AABBRefinementSelection.h b/src/blockforest/AABBRefinementSelection.h
index f92b062d52fea38c889356d80e7f2e66e3ddffa3..184f006ac6d1ea0baceb4469e31883b7e7ca6db7 100644
--- a/src/blockforest/AABBRefinementSelection.h
+++ b/src/blockforest/AABBRefinementSelection.h
@@ -52,20 +52,20 @@ public:
          {
             Config::Blocks aabbBlocks;
             refinementBlock.getBlocks( "AABB", aabbBlocks );
-            for( auto block = aabbBlocks.begin(); block != aabbBlocks.end(); ++block )
+            for(auto & aabbBlock : aabbBlocks)
             {
-               const math::AABB aabb  = block->getParameter< math::AABB >( "AABB" );
-               const uint_t     level = block->getParameter< uint_t >( "level" );
+               const math::AABB aabb  = aabbBlock.getParameter< math::AABB >( "AABB" );
+               const uint_t     level = aabbBlock.getParameter< uint_t >( "level" );
                addAABB( aabb, level );
             }
 
             // For regions, the simulation space is assumed to be [ <0,0,0>, <1,1,1> ]
             Config::Blocks regionBlocks;
             refinementBlock.getBlocks( "Region", regionBlocks );
-            for( auto block = regionBlocks.begin(); block != regionBlocks.end(); ++block )
+            for(auto & regionBlock : regionBlocks)
             {
-               const math::AABB region = block->getParameter< math::AABB >( "region" );
-               const uint_t     level  = block->getParameter< uint_t >( "level" );
+               const math::AABB region = regionBlock.getParameter< math::AABB >( "region" );
+               const uint_t     level  = regionBlock.getParameter< uint_t >( "level" );
                addRegion( region, level );
             }
          }
@@ -91,12 +91,12 @@ public:
       if( aabbs.empty() )
          return;
 
-      for( auto block = forest.begin(); block != forest.end(); ++block )
+      for(auto & block : forest)
       {
-         for( auto aabb = aabbs.begin(); aabb != aabbs.end(); ++aabb )
+         for(auto & aabb : aabbs)
          {
-            if( block->getAABB().intersects( aabb->first ) && block->getLevel() < aabb->second )
-               block->setMarker( true );
+            if( block.getAABB().intersects( aabb.first ) && block.getLevel() < aabb.second )
+               block.setMarker( true );
          }
       }
    }
@@ -108,16 +108,16 @@ public:
       std::vector< std::pair< math::AABB, uint_t > > aabbs = transformRegionsToAABBs( forest.getDomain() );
       aabbs.insert( aabbs.end(), aabbs_.begin(), aabbs_.end() );
 
-      for( auto it = minTargetLevels.begin(); it != minTargetLevels.end(); ++it )
+      for(auto & minTargetLevel : minTargetLevels)
       {
-         uint_t currentLevelOfBlock = it->first->getLevel();
+         uint_t currentLevelOfBlock = minTargetLevel.first->getLevel();
          uint_t targetLevelOfBlock = currentLevelOfBlock;
 
-         for( auto aabb = aabbs.begin(); aabb != aabbs.end(); ++aabb )
+         for(auto & aabb : aabbs)
          {
-            if( it->first->getAABB().intersects( aabb->first ) )
+            if( minTargetLevel.first->getAABB().intersects( aabb.first ) )
             {
-               uint_t targetLevelOfAABB = aabb->second;
+               uint_t targetLevelOfAABB = aabb.second;
                if( currentLevelOfBlock > targetLevelOfAABB )
                {
                   targetLevelOfBlock = currentLevelOfBlock - uint_t(1);
@@ -132,7 +132,7 @@ public:
          }
 
          WALBERLA_CHECK_LESS_EQUAL(std::abs(int_c(targetLevelOfBlock) - int_c(currentLevelOfBlock)), uint_t(1), "Only level difference of maximum 1 allowed!");
-         it->second = targetLevelOfBlock;
+         minTargetLevel.second = targetLevelOfBlock;
       }
    }
 
@@ -142,14 +142,14 @@ private:
    std::vector< std::pair< math::AABB, uint_t > > transformRegionsToAABBs( const math::AABB & simulationDomain ) const
    {
       std::vector< std::pair< math::AABB, uint_t > > aabbs;
-      for( auto region = regions_.begin(); region != regions_.end(); ++region )
+      for(const auto & region : regions_)
       {
-         aabbs.emplace_back( math::AABB( simulationDomain.xMin() + region->first.xMin() * simulationDomain.xSize(),
-                                         simulationDomain.yMin() + region->first.yMin() * simulationDomain.ySize(),
-                                         simulationDomain.zMin() + region->first.zMin() * simulationDomain.zSize(),
-                                         simulationDomain.xMin() + region->first.xMax() * simulationDomain.xSize(),
-                                         simulationDomain.yMin() + region->first.yMax() * simulationDomain.ySize(),
-                                         simulationDomain.zMin() + region->first.zMax() * simulationDomain.zSize() ), region->second );
+         aabbs.emplace_back( math::AABB( simulationDomain.xMin() + region.first.xMin() * simulationDomain.xSize(),
+                                         simulationDomain.yMin() + region.first.yMin() * simulationDomain.ySize(),
+                                         simulationDomain.zMin() + region.first.zMin() * simulationDomain.zSize(),
+                                         simulationDomain.xMin() + region.first.xMax() * simulationDomain.xSize(),
+                                         simulationDomain.yMin() + region.first.yMax() * simulationDomain.ySize(),
+                                         simulationDomain.zMin() + region.first.zMax() * simulationDomain.zSize() ), region.second );
       }
       return aabbs;
    }
diff --git a/src/blockforest/Block.h b/src/blockforest/Block.h
index a61de6ac5c898c0ea1f8bb6a28f0a7b7f33fe002..8e63886ef8b4e33b865c94181f5d7e668f8cdbf3 100644
--- a/src/blockforest/Block.h
+++ b/src/blockforest/Block.h
@@ -292,8 +292,8 @@ inline bool Block::neighborhoodSectionHasLargerBlock( const uint_t sectionIndex
 inline void Block::addNeighbor( const BlockID & id, const uint_t process, const Set<SUID> & state )
 {
 #ifndef NDEBUG
-   for( uint_t i = 0; i != neighborhood_.size(); ++i )
-      WALBERLA_ASSERT( neighborhood_[i].getId() < id || id < neighborhood_[i].getId() );
+   for(const auto & neighbor : neighborhood_)
+      WALBERLA_ASSERT( neighbor.getId() < id || id < neighbor.getId() );
 #endif
 
    neighborhood_.emplace_back( forest_, id, process, state );
diff --git a/src/blockforest/BlockForest.cpp b/src/blockforest/BlockForest.cpp
index 495da585dd97ab39679cebdd38e1267c1c44e018..f2a42f312f52029919b0cb41eb30ea20f1c28b72 100644
--- a/src/blockforest/BlockForest.cpp
+++ b/src/blockforest/BlockForest.cpp
@@ -293,23 +293,23 @@ BlockForest::BlockForest( const uint_t process, const SetupBlockForest& forest,
 
       std::set< uint_t > neighbors;
 
-      for( uint_t i = 0; i != blocks.size(); ++i ) {
+      for(auto & block : blocks) {
 
-         WALBERLA_ASSERT( blocks_.find( blocks[i]->getId() ) == blocks_.end() );
+         WALBERLA_ASSERT( blocks_.find( block->getId() ) == blocks_.end() );
 
-         blocks_[ blocks[i]->getId() ] = std::make_shared< Block >( *this, blocks[i] );
+         blocks_[ block->getId() ] = std::make_shared< Block >( *this, block );
 
-         for( uint_t j = 0; j != blocks[i]->getNeighborhoodSize(); ++j )
-            if( blocks[i]->getNeighbor(j)->getProcess() != process )
-               neighbors.insert( blocks[i]->getNeighbor(j)->getProcess() );
+         for( uint_t j = 0; j != block->getNeighborhoodSize(); ++j )
+            if( block->getNeighbor(j)->getProcess() != process )
+               neighbors.insert( block->getNeighbor(j)->getProcess() );
       }
 
       if( insertBuffersIntoProcessNetwork_ && ( process + 1 ) < forest.getNumberOfProcesses() &&
           forest.isBufferProcess( process + 1 ) )
          neighbors.insert( process + 1 );
 
-      for( std::set< uint_t >::iterator it = neighbors.begin(); it != neighbors.end(); ++it )
-         neighborhood_.push_back( *it );
+      for(uint_t neighbor : neighbors)
+         neighborhood_.push_back( neighbor );
    }
    else if( insertBuffersIntoProcessNetwork_ )
    {
@@ -405,8 +405,8 @@ BlockForest::BlockForest( const uint_t process, const char* const filename, cons
 
    real_t domain[6];
 
-   for( uint_t i = 0; i != 6; ++i ) {
-      domain[i] = byteArrayToReal< real_t >( buffer, offset );
+   for(double & i : domain) {
+      i = byteArrayToReal< real_t >( buffer, offset );
       offset += sizeof( real_t ) + 1 + 2;
    }
 
@@ -414,8 +414,8 @@ BlockForest::BlockForest( const uint_t process, const char* const filename, cons
 
    // number of coarse/root blocks in each direction
 
-   for( uint_t i = 0; i != 3; ++i ) {
-      size_[i] = byteArrayToUint( buffer, offset, 4 );
+   for(uint_t & s : size_) {
+      s = byteArrayToUint( buffer, offset, 4 );
       offset += 4;
    }
 
@@ -827,9 +827,9 @@ std::map< uint_t, std::vector< Vector3<real_t> > > BlockForest::getNeighboringPr
 {
    std::map< uint_t, std::vector< Vector3<real_t> > > offsets;
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
+   for(const auto & it : blocks_)
    {
-      const auto & block = it->second;
+      const auto & block = it.second;
       const AABB & blockAABB = block->getAABB();
 
       const real_t eps[] = { real_c( 1.0E-6 ) * ( blockAABB.xMax() - blockAABB.xMin() ),
@@ -848,13 +848,13 @@ std::map< uint_t, std::vector< Vector3<real_t> > > BlockForest::getNeighboringPr
                const auto sectionIndex = getBlockNeighborhoodSectionIndex( i[0], i[1], i[2] );
                const auto neighbors = block->getNeighborhoodSection( sectionIndex );
 
-               for( auto neighbor = neighbors.begin(); neighbor != neighbors.end(); ++neighbor )
+               for(auto neighbor : neighbors)
                {
-                  if( (*neighbor)->getProcess() == getProcess() )
+                  if( neighbor->getProcess() == getProcess() )
                      continue;
 
                   AABB aabb;
-                  getAABBFromBlockId( aabb, (*neighbor)->getId() );
+                  getAABBFromBlockId( aabb, neighbor->getId() );
 
                   Vector3< real_t > offset;
 
@@ -871,7 +871,7 @@ std::map< uint_t, std::vector< Vector3<real_t> > > BlockForest::getNeighboringPr
                              ( isPeriodic(j) && realIsEqual( std::fabs( offset[j] ), getDomain().max(j) - getDomain().min(j), eps[j] ) ) );
                   }
 
-                  const auto process = (*neighbor)->getProcess();
+                  const auto process = neighbor->getProcess();
                   auto & processOffsets = offsets[ process ];
 
                   bool newOffset = true;
@@ -1071,11 +1071,11 @@ void BlockForest::createSnapshot( const std::vector<uint_t> & sendTo, const std:
       buffer << block->first;
       block->second->toBuffer( buffer );
 
-      for( auto dataItem = blockDataItem_.begin(); dataItem != blockDataItem_.end(); ++dataItem )
+      for(auto & dataItem : blockDataItem_)
       {
-         auto blockDataHandlingWrapper = dataItem->getDataHandling( block->second.get() );
+         auto blockDataHandlingWrapper = dataItem.getDataHandling( block->second.get() );
          if( blockDataHandlingWrapper )
-            blockDataHandlingWrapper->serialize( block->second.get(), dataItem->getId(), buffer );
+            blockDataHandlingWrapper->serialize( block->second.get(), dataItem.getId(), buffer );
       }
    }
 
@@ -1169,19 +1169,19 @@ void BlockForest::restoreSnapshot( const SnapshotRestoreFunction & processMappin
 
    std::set< uint_t > neighborhood;
 
-   for( auto it = snapshot_.begin(); it != snapshot_.end(); ++it )
+   for(auto & it : snapshot_)
    {
-      if( processMapping( it->first ) == process_ )
+      if( processMapping( it.first ) == process_ )
       {
-         mpi::RecvBuffer & buffer = it->second;
+         mpi::RecvBuffer & buffer = it.second;
 
          std::vector< uint_t > pNeighborhood;
          buffer >> pNeighborhood;
 
-         for( auto n = pNeighborhood.begin(); n != pNeighborhood.end(); ++n )
+         for(uint_t & n : pNeighborhood)
          {
-            WALBERLA_ASSERT_LESS( processMapping(*n), uint_c( mpi::MPIManager::instance()->numProcesses() ) );
-            neighborhood.insert( processMapping(*n) );
+            WALBERLA_ASSERT_LESS( processMapping(n), uint_c( mpi::MPIManager::instance()->numProcesses() ) );
+            neighborhood.insert( processMapping(n) );
          }
 
          uint_t blocks( uint_t(0) );
@@ -1199,17 +1199,17 @@ void BlockForest::restoreSnapshot( const SnapshotRestoreFunction & processMappin
             blocks_[ id ] = std::make_shared< Block >( *this, id, aabb, level, buffer, processMapping );
 
             Block * block = blocks_[ id ].get();
-            for( auto dataItem = blockDataItem_.begin(); dataItem != blockDataItem_.end(); ++dataItem )
+            for(auto & dataItem : blockDataItem_)
             {
-               auto blockDataHandlingWrapper = dataItem->getDataHandling( block );
+               auto blockDataHandlingWrapper = dataItem.getDataHandling( block );
                if( blockDataHandlingWrapper )
                {
-                  addBlockData( block, dataItem->getId(), blockDataHandlingWrapper->deserialize( block ) );
-                  blockDataHandlingWrapper->deserialize( block, dataItem->getId(), buffer );
+                  addBlockData( block, dataItem.getId(), blockDataHandlingWrapper->deserialize( block ) );
+                  blockDataHandlingWrapper->deserialize( block, dataItem.getId(), buffer );
                }
                else
                {
-                  addBlockData( block, dataItem->getId(), nullptr );
+                  addBlockData( block, dataItem.getId(), nullptr );
                }
             }
          }
@@ -1218,8 +1218,8 @@ void BlockForest::restoreSnapshot( const SnapshotRestoreFunction & processMappin
 
    WALBERLA_LOG_PROGRESS( "BlockForest restore snapshot: restoring process neighborhood" );
 
-   for( auto n = neighborhood.begin(); n != neighborhood.end(); ++n )
-      neighborhood_.push_back( *n );
+   for(uint_t n : neighborhood)
+      neighborhood_.push_back( n );
 
    rebuildProcessesWithBlocksCommunicator();
 
@@ -1234,8 +1234,8 @@ void BlockForest::restoreSnapshot( const SnapshotRestoreFunction & processMappin
    if( ! callbackAfterBlockDataIsUnpacked_.empty() )
       WALBERLA_LOG_PROGRESS( "BlockForest restore snapshot: executing call back functions after data was restored" );
 
-   for( auto f = callbackAfterBlockDataIsRestored_.begin(); f != callbackAfterBlockDataIsRestored_.end(); ++f )
-      f->second();
+   for(auto & f : callbackAfterBlockDataIsRestored_)
+      f.second();
 
    WALBERLA_MPI_SECTION()
    {
@@ -1281,8 +1281,8 @@ void BlockForest::restoreSnapshot( const SnapshotRestoreFunction & processMappin
             for( auto phantom = phantomBlocks.begin(); phantom != phantomBlocks.end() && !performUpdate; ++phantom )
             {
                const auto & sourceProcess = phantom->second->getSourceProcess();
-               for( auto it = sourceProcess.begin(); it != sourceProcess.end(); ++it )
-                  performUpdate = ( *it != process_ );
+               for(uint_t sourceProces : sourceProcess)
+                  performUpdate = ( sourceProces != process_ );
             }
             mpi::allReduceInplace( performUpdate, mpi::LOGICAL_OR );
          }
@@ -1308,8 +1308,8 @@ void BlockForest::restoreSnapshot( const SnapshotRestoreFunction & processMappin
 void BlockForest::saveToFile( const std::string & filename, FileIOMode fileIOMode ) const
 {
    Set<SUID> suids;
-   for( auto block = blocks_.begin(); block != blocks_.end(); ++block )
-      suids += block->second->getState();
+   for(const auto & block : blocks_)
+      suids += block.second->getState();
 
    std::vector<SUID> localSuids( suids.begin(), suids.end() );
    std::vector<SUID> allSuids = mpi::allReduceSet( localSuids, mpi::UNION );
@@ -1332,11 +1332,11 @@ void BlockForest::saveToFile( const std::string & filename, const Set<SUID> & bl
    std::map< SUID, std::vector< bool > > suidMap;
 
    uint_t i = 0;
-   for( Set<SUID>::const_iterator it = blockStates.begin(); it != blockStates.end(); ++it ) {
+   for(auto blockState : blockStates) {
 
       std::vector< bool > suidBoolVec( 8 * suidBytes );
       suidBoolVec[i] = true;
-      suidMap[ *it ] = suidBoolVec;
+      suidMap[ blockState ] = suidBoolVec;
       ++i;
    }
 
@@ -1388,9 +1388,8 @@ void BlockForest::constructBlockInformation( const SetupBlockForest & forest )
    blockInformation_->nodes_.resize( forest.getNumberOfTrees() );
    auto & nodeForest = blockInformation_->nodes_;
 
-   for( uint_t i = 0; i != blocks.size(); ++i )
+   for(auto block : blocks)
    {
-      const SetupBlock * const block = blocks[i];
       BlockID id( block->getId() );
 
       std::stack< uint_t > index;
@@ -1493,9 +1492,9 @@ void BlockForest::constructBlockInformation( const std::vector< BlockID > & ids,
 void BlockForest::constructBlockInformation()
 {
    std::vector< std::pair< BlockID, std::pair< uint_t, Set<SUID> > > > data;
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
+   for(auto & block : blocks_)
    {
-      data.emplace_back( it->first, std::make_pair( process_, it->second->getState() ) );
+      data.emplace_back( block.first, std::make_pair( process_, block.second->getState() ) );
    }
 
    mpi::SendBuffer sBuffer;
@@ -1513,10 +1512,10 @@ void BlockForest::constructBlockInformation()
    for( int r = 0; r != MPIManager::instance()->numProcesses(); ++r )
    {
       rBuffer >> data;
-      for( auto it = data.begin(); it != data.end(); ++it )
+      for(auto & it : data)
       {
-         ids.push_back( it->first );
-         nodes.push_back( make_shared< BlockInformation::Node >( it->second.first, it->second.second ) );
+         ids.push_back( it.first );
+         nodes.push_back( make_shared< BlockInformation::Node >( it.second.first, it.second.second ) );
       }
       data.clear();
    }
@@ -1900,9 +1899,8 @@ bool BlockForest::determineBlockTargetLevels( bool & additionalRefreshCycleRequi
          WALBERLA_ASSERT( intentToMerge.find( process_ ) != intentToMerge.end() );
 
          const std::set< BlockID > & blocksToCheck = intentToMerge[ process_ ];
-         for( auto it = blocksToCheck.begin(); it != blocksToCheck.end(); ++it )
+         for(const auto & id : blocksToCheck)
          {
-            const BlockID & id = *it;
             WALBERLA_ASSERT( octetMember.find(id) != octetMember.end() );
             const std::map< BlockID, uint_t > & octetMembers = octetMember[id];
             WALBERLA_ASSERT( octetMembers.size() == uint_t(7) );
@@ -2029,8 +2027,8 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
    if( ! callbackBeforeBlockDataIsPacked_.empty() )
       WALBERLA_LOG_PROGRESS( "BlockForest refresh: - executing call back functions before block data is packed" );
 
-   for( auto f = callbackBeforeBlockDataIsPacked_.begin(); f != callbackBeforeBlockDataIsPacked_.end(); ++f )
-      f->second( *this, phantomForest );
+   for(auto & f : callbackBeforeBlockDataIsPacked_)
+      f.second( *this, phantomForest );
 
    //////////////////////////////////////
    // SCHEDULE RECV's FOR BUFFER SIZES //
@@ -2039,21 +2037,21 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
    std::map< uint_t, uint_t > numberOfBlocksToRecv; // does not include local transfers
 
    const auto & phantomBlocks = phantomForest.getBlockMap();
-   for( auto phantom = phantomBlocks.begin(); phantom != phantomBlocks.end(); ++phantom )
+   for(const auto & phantomBlock : phantomBlocks)
    {
-      auto & pBlock = phantom->second;
+      auto & pBlock = phantomBlock.second;
       auto & sourceProcesses = pBlock->getSourceProcess();
       if( pBlock->getSourceLevel() != pBlock->getLevel() || sourceProcesses[0] != process_ )
       {
          WALBERLA_ASSERT( blocks_.find( pBlock->getId() ) == blocks_.end() );
-         for( auto p = sourceProcesses.begin(); p != sourceProcesses.end(); ++p )
+         for(uint_t sourceProcesse : sourceProcesses)
          {
-            if( *p != process_ )
+            if( sourceProcesse != process_ )
             {
-               if( numberOfBlocksToRecv.find( *p ) == numberOfBlocksToRecv.end() )
-                  numberOfBlocksToRecv[*p] = uint_t(1);
+               if( numberOfBlocksToRecv.find( sourceProcesse ) == numberOfBlocksToRecv.end() )
+                  numberOfBlocksToRecv[sourceProcesse] = uint_t(1);
                else
-                  ++(numberOfBlocksToRecv[*p]);
+                  ++(numberOfBlocksToRecv[sourceProcesse]);
             }
          }
       }
@@ -2075,10 +2073,10 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
    WALBERLA_LOG_PROGRESS( "BlockForest refresh: - schedule receives for buffer sizes" );
 
    uint_t i( uint_t(0) );
-   for( auto it = recvBufferSizes.begin(); it != recvBufferSizes.end(); ++it )
+   for(auto & recvBufferSize : recvBufferSizes)
    {
-      MPI_Irecv( static_cast< void * >( &(it->second[0]) ), int_c( it->second.size() ), MPITrait< uint_t >::type(),
-                 int_c( it->first ), 0, MPIManager::instance()->comm(), &(recvBufferSizesRequests[i]) );
+      MPI_Irecv( static_cast< void * >( &(recvBufferSize.second[0]) ), int_c( recvBufferSize.second.size() ), MPITrait< uint_t >::type(),
+                 int_c( recvBufferSize.first ), 0, MPIManager::instance()->comm(), &(recvBufferSizesRequests[i]) );
       ++i;
    }
 
@@ -2090,16 +2088,16 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
 
    std::set< mpi::MPIRank > ranksToRecvFrom;
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
+   for(auto & it : blocks_)
    {
-      auto & block = it->second;
+      auto & block = it.second;
       auto & targetProcesses = block->getTargetProcess();
       if( block->getTargetLevel() != block->getLevel() || targetProcesses[0] != process_ )
       {
          WALBERLA_ASSERT( targetProcesses.size() == uint_t(1) || targetProcesses.size() == uint_t(8) );
-         for( auto p = targetProcesses.begin(); p != targetProcesses.end(); ++p )
-            if( *p != process_ )
-               ranksToRecvFrom.insert( numeric_cast< mpi::MPIRank >(*p) );
+         for(uint_t targetProcesse : targetProcesses)
+            if( targetProcesse != process_ )
+               ranksToRecvFrom.insert( numeric_cast< mpi::MPIRank >(targetProcesse) );
       }
    }
 
@@ -2108,21 +2106,21 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
 
    std::map< uint_t, std::map< BlockID, Set<SUID> > > blockStates;
 
-   for( auto phantom = phantomBlocks.begin(); phantom != phantomBlocks.end(); ++phantom )
+   for(const auto & phantomBlock : phantomBlocks)
    {
-      auto & pBlock = phantom->second;
+      auto & pBlock = phantomBlock.second;
       auto & sourceProcesses = pBlock->getSourceProcess();
       if( pBlock->getSourceLevel() != pBlock->getLevel() || sourceProcesses[0] != process_ )
       {
-         for( auto p = sourceProcesses.begin(); p != sourceProcesses.end(); ++p )
-            blockStates[ *p ][ pBlock->getId() ] = pBlock->getState();
+         for(const uint_t sourceProcesse : sourceProcesses)
+            blockStates[ sourceProcesse ][ pBlock->getId() ] = pBlock->getState();
       }
    }
 
-   for( auto it = blockStates.begin(); it != blockStates.end(); ++it )
+   for(auto & blockState : blockStates)
    {
-      if( it->first != process_ )
-         bufferSystem.sendBuffer( numeric_cast< mpi::MPIRank >( it->first ) ) << it->second;
+      if( blockState.first != process_ )
+         bufferSystem.sendBuffer( numeric_cast< mpi::MPIRank >( blockState.first ) ) << blockState.second;
    }
 
    bufferSystem.sendAll();
@@ -2158,9 +2156,9 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
 
    std::vector< std::pair< Block *, std::vector< mpi::SendBuffer > > > blocksToPack; // includes data that is NOT transfered via MPI but copied locally
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
+   for(auto & it : blocks_)
    {
-      auto & block = it->second;
+      auto & block = it.second;
       auto & targetProcesses = block->getTargetProcess();
       if( block->getTargetLevel() != block->getLevel() || targetProcesses[0] != process_ )
       {
@@ -2249,8 +2247,8 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
 
       // sender block "state"
 
-      for( auto buffer = buffers.begin(); buffer != buffers.end(); ++buffer )
-         *buffer << block->getState();
+      for(auto & buffer : buffers)
+         buffer << block->getState();
 
       // block data
 
@@ -2260,11 +2258,11 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
          WALBERLA_ASSERT_EQUAL( targetProcesses.size(), uint_t(1) );
          WALBERLA_ASSERT_EQUAL( targetState.size(), uint_t(1) );
 
-         for( auto dataItem = blockDataItem_.begin(); dataItem != blockDataItem_.end(); ++dataItem )
+         for(auto & dataItem : blockDataItem_)
          {
-            auto blockDataHandlingWrapper = dataItem->getDataHandling( block, targetState[0] );
+            auto blockDataHandlingWrapper = dataItem.getDataHandling( block, targetState[0] );
             if( blockDataHandlingWrapper )
-               blockDataHandlingWrapper->serialize( block, dataItem->getId(), buffers[0] );
+               blockDataHandlingWrapper->serialize( block, dataItem.getId(), buffers[0] );
          }
       }
       else if( block->targetBlockIsLarger() )
@@ -2329,8 +2327,8 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
 
    WALBERLA_LOG_PROGRESS( "BlockForest refresh: - deleting blocks that are split, merged, and/or transfered" );
 
-   for( auto block = blocksToPack.begin(); block != blocksToPack.end(); ++block )
-      blocks_.erase( block->first->getId() );
+   for(auto & block : blocksToPack)
+      blocks_.erase( block.first->getId() );
 
    ///////////////
    // SEND DATA //
@@ -2347,8 +2345,8 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
 
       auto & sizes = sendBufferSizes[ it->first ];
       WALBERLA_ASSERT( sizes.empty() );
-      for( auto buffer = it->second.begin(); buffer != it->second.end(); ++buffer )
-         sizes.push_back( (*buffer)->size() );
+      for(auto & buffer : it->second)
+         sizes.push_back( buffer->size() );
 
       blockDataSendRequests[ it->first ].resize( it->second.size() ); // do not resize this vector after this point!
    }
@@ -2385,9 +2383,9 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
 
    WALBERLA_LOG_PROGRESS( "BlockForest refresh: - allocating new blocks" );
 
-   for( auto phantom = phantomBlocks.begin(); phantom != phantomBlocks.end(); ++phantom )
+   for(const auto & pbIt : phantomBlocks)
    {
-      auto & pBlock = phantom->second;
+      auto & pBlock = pbIt.second;
       if( pBlock->getSourceLevel() != pBlock->getLevel() || pBlock->getSourceProcess()[0] != process_ )
       {
          WALBERLA_ASSERT( blocks_.find( pBlock->getId() ) == blocks_.end() );
@@ -2469,8 +2467,8 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
 
    WALBERLA_LOG_PROGRESS( "BlockForest refresh: - perform local data transfer" );
 
-   for( auto buffer = localBlocks.begin(); buffer != localBlocks.end(); ++buffer )
-      recvLocalBlocks.emplace_back( **buffer );
+   for(auto & localBlock : localBlocks)
+      recvLocalBlocks.emplace_back( *localBlock );
 
    ////////////////////////////////////
    // WAIT FOR RECV's FOR BLOCK DATA //
@@ -2478,9 +2476,9 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
 
    WALBERLA_LOG_PROGRESS( "BlockForest refresh: - wait for block data to be received" );
 
-   for( auto it = blockDataRecvRequests.begin(); it != blockDataRecvRequests.end(); ++it )
+   for(auto & blockDataRecvRequest : blockDataRecvRequests)
    {
-      auto & requests = it->second;
+      auto & requests = blockDataRecvRequest.second;
       MPI_Waitall( int_c( requests.size() ), &(requests[0]), MPI_STATUSES_IGNORE );
    }
 
@@ -2493,9 +2491,9 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
    if( ! sendBufferSizesRequests.empty() )
       MPI_Waitall( int_c( sendBufferSizesRequests.size() ), &(sendBufferSizesRequests[0]), MPI_STATUSES_IGNORE );
 
-   for( auto it = blockDataSendRequests.begin(); it != blockDataSendRequests.end(); ++it )
+   for(auto & blockDataSendRequest : blockDataSendRequests)
    {
-      auto & requests = it->second;
+      auto & requests = blockDataSendRequest.second;
       MPI_Waitall( int_c( requests.size() ), &(requests[0]), MPI_STATUSES_IGNORE );
    }
 
@@ -2505,11 +2503,11 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
 
    WALBERLA_LOG_PROGRESS( "BlockForest refresh: - clear send buffers (= free memory)" );
 
-   for( auto it = blocksToPack.begin(); it != blocksToPack.end(); ++it )
+   for(auto & it : blocksToPack)
    {
-      auto & buffers = it->second;
-      for( auto buffer = buffers.begin(); buffer != buffers.end(); ++buffer )
-         buffer->reset();
+      auto & buffers = it.second;
+      for(auto & buffer : buffers)
+         buffer.reset();
    }
 
    ////////////////////////////////
@@ -2520,17 +2518,17 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
 
    std::map< Block *, std::vector< std::pair< Set<SUID>, mpi::RecvBuffer * > > > blocksToUnpack; // includes data that is NOT transfered via MPI but copied locally
 
-   for( auto it = recvBlockData.begin(); it != recvBlockData.end(); ++it )
+   for(auto & it : recvBlockData)
    {
-      auto & buffers = it->second;
-      for( auto buffer = buffers.begin(); buffer != buffers.end(); ++buffer )
+      auto & buffers = it.second;
+      for(auto & buffer : buffers)
       {
          // header = sender block ID + receiver block ID & sender block "state"
 
          BlockID sId;
          BlockID rId;
          Set<SUID> state;
-         (*buffer) >> sId >> rId >> state;
+         buffer >> sId >> rId >> state;
 
          WALBERLA_ASSERT( blocks_.find( rId ) != blocks_.end() );
          WALBERLA_ASSERT( phantomBlocks.find( rId ) != phantomBlocks.end() );
@@ -2540,7 +2538,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
          if( phantom->sourceBlockHasTheSameSize() || phantom->sourceBlockIsLarger() )
          {
             WALBERLA_ASSERT( blocksToUnpack.find( block ) == blocksToUnpack.end() );
-            blocksToUnpack[ block ].emplace_back( state, &(*buffer) );
+            blocksToUnpack[ block ].emplace_back( state, &buffer );
          }
          else
          {
@@ -2548,7 +2546,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
             if( bufferPtrs.empty() )
                bufferPtrs.resize( uint_t(8), std::make_pair( Set<SUID>::emptySet(), static_cast< mpi::RecvBuffer * >(nullptr) ) );
             WALBERLA_ASSERT_EQUAL( sId.getUsedBits(), rId.getUsedBits() + uint_t(3) );
-            bufferPtrs[ sId.getBranchId() ] = std::make_pair( state, &(*buffer) );
+            bufferPtrs[ sId.getBranchId() ] = std::make_pair( state, &buffer );
          }
       }
    }
@@ -2589,8 +2587,8 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
    if( ! callbackBeforeBlockDataIsUnpacked_.empty() )
       WALBERLA_LOG_PROGRESS( "BlockForest refresh: - executing call back functions before block data is unpacked" );
 
-   for( auto f = callbackBeforeBlockDataIsUnpacked_.begin(); f != callbackBeforeBlockDataIsUnpacked_.end(); ++f )
-      f->second( *this, phantomForest );
+   for(auto & f : callbackBeforeBlockDataIsUnpacked_)
+      f.second( *this, phantomForest );
 
    /////////////////
    // UNPACK DATA //
@@ -2600,8 +2598,8 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
 
    std::vector< std::pair< Block *, std::vector< std::pair< Set<SUID>, mpi::RecvBuffer * > > > > dataToUnpack;
 
-   for( auto it = blocksToUnpack.begin(); it != blocksToUnpack.end(); ++it )
-      dataToUnpack.emplace_back( it->first, it->second );
+   for(auto & it : blocksToUnpack)
+      dataToUnpack.emplace_back( it.first, it.second );
 
    //#ifdef _OPENMP
    //#pragma omp parallel for schedule(dynamic)
@@ -2620,23 +2618,23 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
       {
          WALBERLA_ASSERT_EQUAL( buffers.size(), uint_t(1) );
 
-         for( auto dataItem = blockDataItem_.begin(); dataItem != blockDataItem_.end(); ++dataItem )
+         for(auto & dataItem : blockDataItem_)
          {
             // allocate
             {
-               auto blockDataHandlingWrapper = dataItem->getDataHandling( block );
+               auto blockDataHandlingWrapper = dataItem.getDataHandling( block );
                if( blockDataHandlingWrapper )
-                  addBlockData( block, dataItem->getId(), blockDataHandlingWrapper->deserialize( block ) );
+                  addBlockData( block, dataItem.getId(), blockDataHandlingWrapper->deserialize( block ) );
                else
-                  addBlockData( block, dataItem->getId(), nullptr );
+                  addBlockData( block, dataItem.getId(), nullptr );
             }
             // fill with sent data
             {
-               auto blockDataHandlingWrapper = dataItem->getDataHandling( block, buffers[0].first );
+               auto blockDataHandlingWrapper = dataItem.getDataHandling( block, buffers[0].first );
                if( blockDataHandlingWrapper )
                {
                   WALBERLA_ASSERT_NOT_NULLPTR( buffers[0].second );
-                  blockDataHandlingWrapper->deserialize( block, dataItem->getId(), *(buffers[0].second) );
+                  blockDataHandlingWrapper->deserialize( block, dataItem.getId(), *(buffers[0].second) );
                }
             }
          }
@@ -2738,8 +2736,8 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
          }
       }
 
-      for( auto it = buffers.begin(); it != buffers.end(); ++it )
-         it->second->reset();
+      for(auto & buffer : buffers)
+         buffer.second->reset();
    }
 
    //////////////
@@ -2749,8 +2747,8 @@ void BlockForest::update( PhantomBlockForest & phantomForest )
    if( ! callbackAfterBlockDataIsUnpacked_.empty() )
       WALBERLA_LOG_PROGRESS( "BlockForest refresh: - executing call back functions after block data was unpacked" );
 
-   for( auto f = callbackAfterBlockDataIsUnpacked_.begin(); f != callbackAfterBlockDataIsUnpacked_.end(); ++f )
-      f->second( *this, phantomForest );
+   for(auto & f : callbackAfterBlockDataIsUnpacked_)
+      f.second( *this, phantomForest );
 }
 
 
@@ -2769,8 +2767,8 @@ void BlockForest::saveToFile( const std::string & filename, FileIOMode fileIOMod
    {
       dataSize += internal::FILE_HEADER_SIZE; // header
       ++dataSize; // number of SUIDs
-      for( auto suid = suidMap.begin(); suid != suidMap.end(); ++suid )
-         dataSize += uint_t(1) + uint_c( suid->first.getIdentifier().length() );
+      for(const auto & suid : suidMap)
+         dataSize += uint_t(1) + uint_c( suid.first.getIdentifier().length() );
    }
 
    std::vector< uint8_t > processDataBuffer( dataSize );
@@ -2785,13 +2783,13 @@ void BlockForest::saveToFile( const std::string & filename, FileIOMode fileIOMod
 
       std::vector< SUID > suids( suidMap.size() );
 
-      for( auto suid = suidMap.begin(); suid != suidMap.end(); ++suid )
+      for(const auto & suid : suidMap)
       {
          for( uint_t i = uint_t(0); i != suids.size(); ++i )
          {
-            if( suid->second[i] )
+            if( suid.second[i] )
             {
-               suids[i] = suid->first;
+               suids[i] = suid.first;
                break;
             }
          }
@@ -2802,11 +2800,11 @@ void BlockForest::saveToFile( const std::string & filename, FileIOMode fileIOMod
 
       // for every SUID ...
 
-      for( auto it = suids.begin(); it != suids.end(); ++it )
+      for(auto & suid : suids)
       {
          // length of its identifier string
 
-         const uint_t length = it->getIdentifier().length();
+         const uint_t length = suid.getIdentifier().length();
          WALBERLA_CHECK_LESS( length, 256, "SUID identifiers are allowed to consist of 255 characters at most when saving the block structure to file!" );
 
          uintToByteArray( length, processDataBuffer, offset, 1 );
@@ -2814,7 +2812,7 @@ void BlockForest::saveToFile( const std::string & filename, FileIOMode fileIOMod
 
          // the identifier string
 
-         const char * str = it->getIdentifier().c_str();
+         const char * str = suid.getIdentifier().c_str();
          for( uint_t j = 0; j != length; ++j )
             processDataBuffer[offset+j] = *reinterpret_cast< const uint8_t* >( str + j );
          offset += length;
@@ -2837,14 +2835,14 @@ void BlockForest::saveToFile( const std::string & filename, FileIOMode fileIOMod
          std::vector< bool > suidBoolVec( 8 * suidBytes );
 
          const Set<SUID> & state = block->second->getState();
-         for( auto suid = state.begin(); suid != state.end(); ++suid )
+         for(auto suid : state)
          {
-            WALBERLA_CHECK( suidMap.find( *suid ) != suidMap.end(), "Block state SUID missing from SUID list saved to file."
-                                                                    "\n- SUID = " << *suid << "\n- block ID = " << block->first <<
+            WALBERLA_CHECK( suidMap.find( suid ) != suidMap.end(), "Block state SUID missing from SUID list saved to file."
+                                                                    "\n- SUID = " << suid << "\n- block ID = " << block->first <<
                                                                     "\n- block AABB = " << block->second->getAABB() );
             //Elementwise OR of all elements
             for (uint_t i = 0; i < suidBoolVec.size(); ++i) {
-               suidBoolVec[i] = suidBoolVec[i] || suidMap.find( *suid )->second[i];
+               suidBoolVec[i] = suidBoolVec[i] || suidMap.find( suid )->second[i];
             }
          }
 
@@ -2857,9 +2855,9 @@ void BlockForest::saveToFile( const std::string & filename, FileIOMode fileIOMod
    uintToByteArray( uint_c( neighborhood_.size() ), processDataBuffer, offset, uint_t(2) );
    offset += uint_t(2);
 
-   for( auto neighbor = neighborhood_.begin(); neighbor != neighborhood_.end(); ++neighbor )
+   for(uint_t neighbor : neighborhood_)
    {
-      uintToByteArray( *neighbor, processDataBuffer, offset, processIdBytes_ );
+      uintToByteArray( neighbor, processDataBuffer, offset, processIdBytes_ );
       offset += processIdBytes_;
    }
 
@@ -3005,8 +3003,8 @@ void BlockForest::storeFileHeader( std::vector< uint8_t > & data, uint_t & offse
 
    // number of coarse/root blocks in each direction
 
-   for( uint_t i = 0; i != 3; ++i ) {
-      uintToByteArray( size_[i], data, offset, 4 );
+   for(unsigned long i : size_) {
+      uintToByteArray( i, data, offset, 4 );
       offset += 4;
    }
 
@@ -3054,9 +3052,7 @@ void BlockForest::checkBlockInformationConsistency( const SetupBlockForest& fore
    std::vector< const SetupBlock* > blocks;
    forest.getBlocks( blocks );
 
-   for( uint_t i = 0; i != blocks.size(); ++i ) {
-      const SetupBlock* const block = blocks[i];
-
+   for(auto block : blocks) {
       uint_t process = 0;
       WALBERLA_ASSERT( getBlockInformation().getProcess( process, block->getId() ) );
       WALBERLA_ASSERT_EQUAL( process, block->getProcess() );
diff --git a/src/blockforest/BlockForest.h b/src/blockforest/BlockForest.h
index c000ecff5f8fd484857b06ebda0bed7be79e4907..0e639b729948eecef4bf254a2b22b554b8abbb26 100644
--- a/src/blockforest/BlockForest.h
+++ b/src/blockforest/BlockForest.h
@@ -578,8 +578,8 @@ inline uint_t BlockForest::getNumberOfBlocks( const uint_t level ) const {
 
    uint_t numberOfBlocks = 0;
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
-      if( it->second->getLevel() == level ) ++numberOfBlocks;
+   for(const auto & bIt : blocks_)
+      if(bIt.second->getLevel() == level ) ++numberOfBlocks;
 
    return numberOfBlocks;
 }
@@ -588,48 +588,48 @@ inline uint_t BlockForest::getNumberOfBlocks( const uint_t level ) const {
 
 inline void BlockForest::getBlocks( std::vector< const Block* >& blocks, const uint_t level ) const {
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
-      if( it->second->getLevel() == level ) blocks.push_back( it->second.get() );
+   for(const auto & bIt : blocks_)
+      if(bIt.second->getLevel() == level ) blocks.push_back(bIt.second.get() );
 }
 
 
 
 inline void BlockForest::getBlocks( std::vector< Block* >& blocks, const uint_t level ) {
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
-      if( it->second->getLevel() == level ) blocks.push_back( it->second.get() );
+   for(auto & bIt : blocks_)
+      if(bIt.second->getLevel() == level ) blocks.push_back(bIt.second.get() );
 }
 
 
 
 inline void BlockForest::getBlocksContainedWithinAABB( std::vector< const IBlock* >& blocks, const AABB& aabb ) const {
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
-      if( aabb.contains( it->second->getAABB() ) ) blocks.push_back( it->second.get() );
+   for(const auto & bIt : blocks_)
+      if( aabb.contains(bIt.second->getAABB() ) ) blocks.push_back(bIt.second.get() );
 }
 
 
 
 inline void BlockForest::getBlocksContainedWithinAABB( std::vector< IBlock* >& blocks, const AABB& aabb ) {
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
-      if( aabb.contains( it->second->getAABB() ) ) blocks.push_back( it->second.get() );
+   for(auto & bIt : blocks_)
+      if( aabb.contains(bIt.second->getAABB() ) ) blocks.push_back(bIt.second.get() );
 }
 
 
 
 inline void BlockForest::getBlocksOverlappedByAABB( std::vector< const IBlock* >& blocks, const AABB& aabb ) const {
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
-      if( it->second->getAABB().intersects( aabb ) ) blocks.push_back( it->second.get() );
+   for(const auto & bIt : blocks_)
+      if( bIt.second->getAABB().intersects(aabb ) ) blocks.push_back(bIt.second.get() );
 }
 
 
 
 inline void BlockForest::getBlocksOverlappedByAABB( std::vector< IBlock* >& blocks, const AABB& aabb ) {
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
-      if( it->second->getAABB().intersects( aabb ) ) blocks.push_back( it->second.get() );
+   for(auto & bIt : blocks_)
+      if( bIt.second->getAABB().intersects(aabb ) ) blocks.push_back(bIt.second.get() );
 }
 
 
@@ -664,8 +664,8 @@ inline Block* BlockForest::getBlock( const IBlockID& id ) {
 
 inline const Block* BlockForest::getBlock( const real_t x, const real_t y, const real_t z ) const {
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
-      if( it->second->getAABB().contains(x,y,z) ) return it->second.get();
+   for(const auto & bIt : blocks_)
+      if( bIt.second->getAABB().contains(x, y, z) ) return bIt.second.get();
 
    return nullptr;
 }
@@ -674,8 +674,8 @@ inline const Block* BlockForest::getBlock( const real_t x, const real_t y, const
 
 inline Block* BlockForest::getBlock( const real_t x, const real_t y, const real_t z ) {
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
-      if( it->second->getAABB().contains(x,y,z) ) return it->second.get();
+   for(auto & bIt : blocks_)
+      if( bIt.second->getAABB().contains(x, y, z) ) return bIt.second.get();
 
    return nullptr;
 }
@@ -976,8 +976,8 @@ public:
                     std::vector< const Block * > & blocksAlreadyMarkedForRefinement,
                     const blockforest::BlockForest & forest )
    {
-      for( auto function = functions_.begin(); function != functions_.end(); ++function )
-         (*function)( minTargetLevels, blocksAlreadyMarkedForRefinement, forest );
+      for(auto & function : functions_)
+         function( minTargetLevels, blocksAlreadyMarkedForRefinement, forest );
    }
 
 private:
diff --git a/src/blockforest/BlockForestEvaluation.cpp b/src/blockforest/BlockForestEvaluation.cpp
index d587ef264fdc2f2ec84107fed85d41aa789da683..84474e604ae225d4019c448b5ec0a1ad6ab6ae2c 100644
--- a/src/blockforest/BlockForestEvaluation.cpp
+++ b/src/blockforest/BlockForestEvaluation.cpp
@@ -123,8 +123,8 @@ void BlockForestEvaluation::toStream( std::ostream & os ) const
       if( !blockData.empty() )
       {
          os << "\n- block data:";
-         for( auto data = blockData.begin(); data != blockData.end(); ++data )
-            os << "\n   + " << *data;
+         for(auto & data : blockData)
+            os << "\n   + " << data;
       }
 
       os << "\n- number of already performed restructure cycles: " << forest_.getModificationStamp()
diff --git a/src/blockforest/BlockReconstruction.h b/src/blockforest/BlockReconstruction.h
index c41689b94ea3e717486676452257d020579fe59a..f1c836489980d036928844df27c6439e92d59475 100644
--- a/src/blockforest/BlockReconstruction.h
+++ b/src/blockforest/BlockReconstruction.h
@@ -158,20 +158,20 @@ void BlockReconstruction::reconstructNeighborhood( BLOCK* block, const std::vect
          if( z <  domain.zMin() && zPeriodic ) z = domain.zMax() - domain.zMin() + z;
          if( z >= domain.zMax() && zPeriodic ) z = domain.zMin() - domain.zMax() + z;
 
-         for( uint_t i = 0; i != neighbors.size(); ++i ) {
-            if( neighbors[i].getAABB().contains( x, y, z ) ) {
+         for(const auto & neighbor : neighbors) {
+            if( neighbor.getAABB().contains(x, y, z ) ) {
 
-               const NeighborhoodReconstructionBlock* neighbor = &(neighbors[i]);
+               const NeighborhoodReconstructionBlock* neighborPtr = &neighbor;
                uint_t index = 0;
 
-               if( neighborhood.insert( neighbor ).second ) {
+               if( neighborhood.insert(neighborPtr ).second ) {
 
                   index = block->getNeighborhoodSize();
-                  neighborhoodIndex[ neighbor ] = index;
+                  neighborhoodIndex[ neighborPtr ] = index;
 
-                  block->addNeighbor( neighbor->getId(), neighbor->getProcess(), neighbor->getState() );
+                  block->addNeighbor(neighborPtr->getId(), neighborPtr->getProcess(), neighborPtr->getState() );
                }
-               else index = neighborhoodIndex[ neighbor ];
+               else index = neighborhoodIndex[ neighborPtr ];
 
                if( neighborhoodSectionBlocks[n].empty() || neighborhoodSectionBlocks[n].back() != index )
                   neighborhoodSectionBlocks[n].push_back( index );
@@ -274,8 +274,8 @@ void BlockReconstruction::reconstructNeighborhoodSections( BLOCK* block, const A
 
       block->clearNeighborhoodSection(n);
 
-      for( uint_t i = 0; i != neighborhoodSectionBlocks.size(); ++i )
-         block->addNeighbor( n, neighborhoodSectionBlocks[i] );
+      for(uint_t & neighborhoodSectionBlock : neighborhoodSectionBlocks)
+         block->addNeighbor( n, neighborhoodSectionBlock );
 
       neighborhoodSectionBlocks.clear();
       neighborhoodSectionBlockCenters.clear();
diff --git a/src/blockforest/GlobalLoadBalancing.h b/src/blockforest/GlobalLoadBalancing.h
index ca1509453d683bf2457c1d91a0c6a1b9f465fb75..d3708ee05e00bac4788187078bf08f356e3eb55b 100644
--- a/src/blockforest/GlobalLoadBalancing.h
+++ b/src/blockforest/GlobalLoadBalancing.h
@@ -386,8 +386,8 @@ uint_t GlobalLoadBalancing::balanceSorted( const std::vector< BLOCK* >& blocks,
          minWorkload = std::max( minWorkload, sortedBlocks[l][i]->getWorkload() );
          WALBERLA_ASSERT_LESS_EQUAL( sortedBlocks[l][i]->getMemory(), memoryLimit );
       }
-      for( uint_t i = 0; i != processesWork.size(); ++i )
-         minWorkload = std::max( minWorkload, processesWork[i] );
+      for(double i : processesWork)
+         minWorkload = std::max( minWorkload, i );
 
       // check min - potentially nothing more to do
 
@@ -696,9 +696,7 @@ void GlobalLoadBalancing::reorderProcessesByBFS( std::vector< BLOCK* > & blocks,
 
          reorderMap[p] = process++;
 
-         for( uint_t i = 0; i != processNeighbors[p].size(); ++i ) {
-            const uint_t neighbor = processNeighbors[p][i];
-
+         for(unsigned long neighbor : processNeighbors[p]) {
             if( !processed[neighbor] ) {
                processList.push_back( neighbor );
                processed[neighbor] = true;
@@ -1066,8 +1064,8 @@ uint_t GlobalLoadBalancing::metisAdaptPartVector( std::vector< int64_t >& part,
    {
       if( !hasBlock[ uint_c(i) ] )
       {
-         for( uint_t j = 0; j != part.size(); ++j )
-            if( part[j] > i ) --part[j];
+         for(int64_t & j : part)
+            if( j > i ) --j;
       }
       else
          ++nProcesses;
diff --git a/src/blockforest/Initialization.cpp b/src/blockforest/Initialization.cpp
index d800a75b10a112edba39a6655c84bfad53cb1426..5f8109c0d4e0397a2074576b0df85efa31babc6c 100644
--- a/src/blockforest/Initialization.cpp
+++ b/src/blockforest/Initialization.cpp
@@ -270,10 +270,10 @@ public:
    FixedRefinementLevelSelector( const uint_t level ) : level_(level) {}
    void operator()( SetupBlockForest& forest )
    {
-      for( auto block = forest.begin(); block != forest.end(); ++block )
+      for(auto & block : forest)
       {
-         if( block->getLevel() < level_ )
-            block->setMarker( true );
+         if( block.getLevel() < level_ )
+            block.setMarker( true );
       }
    }
 private:
@@ -796,9 +796,9 @@ void uniformWorkloadAndMemoryAssignment( SetupBlockForest& forest ) {
    std::vector< SetupBlock* > blocks;
    forest.getBlocks( blocks );
 
-   for( uint_t i = 0; i != blocks.size(); ++i ) {
-      blocks[i]->setWorkload( numeric_cast< workload_t >(1) );
-      blocks[i]->setMemory( numeric_cast< memory_t >(1) );
+   for(auto & block : blocks) {
+      block->setWorkload( numeric_cast< workload_t >(1) );
+      block->setMemory( numeric_cast< memory_t >(1) );
    }
 }
 
@@ -852,9 +852,9 @@ memory_t uniformFacesDominantCommunication( const SetupBlock* const a, const Set
 
    uint_t faces[] = { 4, 10, 12, 13, 15, 21 };
 
-   for( uint_t i = 0; i != 6; ++i ) {
-      for( uint_t j = 0; j != a->getNeighborhoodSectionSize(faces[i]); ++j )
-         if( a->getNeighbor(faces[i],j) == b )
+   for(unsigned long face : faces) {
+      for( uint_t j = 0; j != a->getNeighborhoodSectionSize(face); ++j )
+         if( a->getNeighbor(face,j) == b )
             return numeric_cast< memory_t >(1000);
    }
 
diff --git a/src/blockforest/PhantomBlock.h b/src/blockforest/PhantomBlock.h
index 3872a72610f8ac4d72e095d48573d2c5f069b005..af2da9ee379273b6e62456bc64b67a79e6f9705f 100644
--- a/src/blockforest/PhantomBlock.h
+++ b/src/blockforest/PhantomBlock.h
@@ -300,8 +300,8 @@ inline bool PhantomBlock::neighborhoodSectionHasLargerBlock( const uint_t sectio
 inline void PhantomBlock::addNeighbor( const BlockID & id, const uint_t process, const Set<SUID> & state )
 {
 #ifndef NDEBUG
-   for( uint_t i = 0; i != neighborhood_.size(); ++i )
-      WALBERLA_ASSERT( neighborhood_[i].getId() < id || id < neighborhood_[i].getId() );
+   for(const auto & i : neighborhood_)
+      WALBERLA_ASSERT( i.getId() < id || id < i.getId() );
 #endif
 
    neighborhood_.emplace_back( phantomForest_, id, process, state );
diff --git a/src/blockforest/PhantomBlockForest.cpp b/src/blockforest/PhantomBlockForest.cpp
index fe7f8e1d3c09cbdc2b799f3bda07e09b8bbd4539..237efb824b495359b9dcfa6f27fa46807c6b8774 100644
--- a/src/blockforest/PhantomBlockForest.cpp
+++ b/src/blockforest/PhantomBlockForest.cpp
@@ -134,13 +134,13 @@ void PhantomBlockForest::initialize( const BlockStateDeterminationFunction & fun
 
             std::vector< uint_t > sourceProcesses( uint_t(8), process );
             const auto & neighborhood = block->getNeighborhood();
-            for( auto neighbor = neighborhood.begin(); neighbor != neighborhood.end(); ++neighbor )
+            for(const auto & neighbor : neighborhood)
             {
-               auto & nid = neighbor->getId();
+               auto & nid = neighbor.getId();
                if( blockforest_.getLevelFromBlockId( nid ) == level && nid.getFatherId() == fid )
                {
-                  sourceProcesses[ neighbor->getId().getBranchId() ] = neighbor->getProcess();
-                  sourceStates[ neighbor->getId().getBranchId() ] = std::make_pair( nid, neighbor->getState() );
+                  sourceProcesses[ neighbor.getId().getBranchId() ] = neighbor.getProcess();
+                  sourceStates[ neighbor.getId().getBranchId() ] = std::make_pair( nid, neighbor.getState() );
                }
             }
 
@@ -158,13 +158,13 @@ void PhantomBlockForest::initialize( const BlockStateDeterminationFunction & fun
          else
          {
             const auto & neighborhood = block->getNeighborhood();
-            for( auto neighbor = neighborhood.begin(); neighbor != neighborhood.end(); ++neighbor )
+            for(const auto & neighbor : neighborhood)
             {
-               const auto & nid = neighbor->getId();
+               const auto & nid = neighbor.getId();
                if( blockforest_.getLevelFromBlockId( nid ) == level && nid.getFatherId() == fid && nid.getBranchId() == uint_t(0) )
                {
                   WALBERLA_ASSERT_EQUAL( block->getTargetProcess().size(), uint_t(0) );
-                  block->addTargetProcess( neighbor->getProcess() );
+                  block->addTargetProcess( neighbor.getProcess() );
 #ifdef NDEBUG
                   break;
 #endif
@@ -175,9 +175,9 @@ void PhantomBlockForest::initialize( const BlockStateDeterminationFunction & fun
       }
 
       const auto & neighborhood = block->getNeighborhood();
-      for( auto neighbor = neighborhood.begin(); neighbor != neighborhood.end(); ++neighbor )
-         if( neighbor->getProcess() != process )
-            ranksToRecvFrom.insert( numeric_cast< mpi::MPIRank >( neighbor->getProcess() ) );
+      for(const auto & neighbor : neighborhood)
+         if( neighbor.getProcess() != process )
+            ranksToRecvFrom.insert( numeric_cast< mpi::MPIRank >( neighbor.getProcess() ) );
 
       if( recalculateDepth )
          depth_ = std::max( depth_, targetLevel );
@@ -200,10 +200,10 @@ void PhantomBlockForest::initialize( const BlockStateDeterminationFunction & fun
 
    for( int i = 0; i != 2; ++i )
    {
-      for( auto rank = ranksToRecvFrom.begin(); rank != ranksToRecvFrom.end(); ++rank )
+      for(mpi::MPIRank rank : ranksToRecvFrom)
       {
-         WALBERLA_ASSERT_UNEQUAL( uint_c(*rank), process );
-         bufferSystem.sendBuffer( *rank ) << blockNeighborhood[ process ];
+         WALBERLA_ASSERT_UNEQUAL( uint_c(rank), process );
+         bufferSystem.sendBuffer( rank ) << blockNeighborhood[ process ];
       }
 
       bufferSystem.sendAll();
@@ -217,12 +217,12 @@ void PhantomBlockForest::initialize( const BlockStateDeterminationFunction & fun
       }
 
       std::map< BlockID, std::pair< uint_t, Set<SUID> > > & localMap = blockNeighborhood[ process ];
-      for( auto it = blockNeighborhood.begin(); it != blockNeighborhood.end(); ++it )
+      for(auto & it : blockNeighborhood)
       {
-         if( it->first != process )
+         if( it.first != process )
          {
             // localMap.insert( it->second.begin(), it->second.end() ); // using 'insert' doesn't allow to assert consistency ... -> manual for loop
-            for( auto blockProcessPair = it->second.begin(); blockProcessPair != it->second.end(); ++blockProcessPair )
+            for( auto blockProcessPair = it.second.begin(); blockProcessPair != it.second.end(); ++blockProcessPair )
             {
 #ifndef NDEBUG
                if( localMap.find( blockProcessPair->first ) != localMap.end() )
@@ -230,7 +230,7 @@ void PhantomBlockForest::initialize( const BlockStateDeterminationFunction & fun
 #endif
                localMap[ blockProcessPair->first ] = blockProcessPair->second;
             }
-            it->second.clear();
+            it.second.clear();
          }
       }
    }
@@ -238,16 +238,16 @@ void PhantomBlockForest::initialize( const BlockStateDeterminationFunction & fun
    std::vector< BlockReconstruction::NeighborhoodReconstructionBlock > neighbors;
 
    std::map< BlockID, std::pair< uint_t, Set<SUID> > > & localMap = blockNeighborhood[ process ];
-   for( auto it = localMap.begin(); it != localMap.end(); ++it )
-      neighbors.emplace_back( it->first, it->second.first, it->second.second, aabbReconstruction );
+   for(auto & it : localMap)
+      neighbors.emplace_back( it.first, it.second.first, it.second.second, aabbReconstruction );
 
    BlockReconstruction::NeighborhoodReconstruction< PhantomBlock > neighborhoodReconstruction( blockforest_.getDomain(),
                                                                                                blockforest_.isXPeriodic(),
                                                                                                blockforest_.isYPeriodic(),
                                                                                                blockforest_.isZPeriodic() );
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it ) // TODO: can be done in parallel with OpenMP
-      neighborhoodReconstruction( it->second.get(), neighbors );
+   for(auto & block : blocks_) // TODO: can be done in parallel with OpenMP
+      neighborhoodReconstruction( block.second.get(), neighbors );
 
    updateNeighborhood();
 }
@@ -260,9 +260,9 @@ void PhantomBlockForest::assignBlockData( const PhantomBlockDataAssignmentFuncti
    {
       std::vector< std::pair< const PhantomBlock *, walberla::any > > blockData;
    
-      for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
+      for(auto & it : blocks_)
       {
-         auto & block = it->second;
+         auto & block = it.second;
          WALBERLA_ASSERT_NOT_NULLPTR( block.get() );
          blockData.emplace_back( block.get(), walberla::any() );
       }
@@ -294,9 +294,9 @@ bool PhantomBlockForest::calculateMigrationInformation( const MigrationPreparati
    {
       std::vector< std::pair< const PhantomBlock *, uint_t > > targetProcess;
    
-      for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
+      for(auto & it : blocks_)
       {
-         auto & block = it->second;
+         auto & block = it.second;
          WALBERLA_ASSERT_NOT_NULLPTR( block.get() );
          targetProcess.emplace_back( block.get(), block->getTargetProcess() );
       }
@@ -344,18 +344,18 @@ void PhantomBlockForest::migrate( const PhantomBlockDataPackFunction & packBlock
 
    std::map< uint_t, std::vector< PhantomBlock * > > blocksToSend;
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
+   for(auto & it : blocks_)
    {
-      auto & block = it->second;
+      auto & block = it.second;
       WALBERLA_ASSERT_NOT_NULLPTR( block.get() );
       if( block->getTargetProcess() != process )
          blocksToSend[ block->getTargetProcess() ].push_back( block.get() );
    }
 
    std::set< mpi::MPIRank > ranksToRecvFrom;
-   for( auto p = processesToRecvFrom_.begin(); p != processesToRecvFrom_.end(); ++p )
-      if( *p != process )
-         ranksToRecvFrom.insert( static_cast< mpi::MPIRank >(*p) );
+   for(uint_t p : processesToRecvFrom_)
+      if( p != process )
+         ranksToRecvFrom.insert( static_cast< mpi::MPIRank >(p) );
 
    // TODO: use OpenMP buffer system?
    mpi::BufferSystem bufferSystem( MPIManager::instance()->comm(), 1944 ); // phantomblockforest = 112 104 97 110 116 111 109 98 108 111 99 107 102 111 114 101 115 116 + 3
@@ -373,9 +373,8 @@ void PhantomBlockForest::migrate( const PhantomBlockDataPackFunction & packBlock
       // TODO: Is the data amount reduction really necessary? Is it even a good idea?!
 
       buffer << uint_c( blocks.size() );
-      for( auto block = blocks.begin(); block != blocks.end(); ++block )
+      for(auto pBlock : blocks)
       {
-         auto * pBlock = *block;
          WALBERLA_ASSERT_NOT_NULLPTR( pBlock );
 
          buffer << pBlock->getId() << pBlock->getState();
@@ -516,8 +515,8 @@ void PhantomBlockForest::updateNeighborhood()
    if( blockforest_.insertBuffersIntoProcessNetwork() )
    {
       std::map< mpi::MPIRank, mpi::MPISize > ranksToRecvFrom;
-      for( auto n = neighborhood_.begin(); n != neighborhood_.end(); ++n )
-         ranksToRecvFrom[ static_cast< mpi::MPIRank >(*n) ] = mpi::BufferSizeTrait<int>::size;
+      for(uint_t & n : neighborhood_)
+         ranksToRecvFrom[ static_cast< mpi::MPIRank >(n) ] = mpi::BufferSizeTrait<int>::size;
 
       mpi::BufferSystem bufferSystem( MPIManager::instance()->comm(), 1942 ); // phantomblockforest = 112 104 97 110 116 111 109 98 108 111 99 107 102 111 114 101 115 116 + 1
       bufferSystem.setReceiverInfo( ranksToRecvFrom );
@@ -546,19 +545,19 @@ void PhantomBlockForest::updateNeighborhood()
    }
 
    const uint_t process = blockforest_.getProcess();
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
+   for(auto & it : blocks_)
    {
-      auto & block = it->second;
+      auto & block = it.second;
       WALBERLA_ASSERT_NOT_NULLPTR( block.get() );
       const auto & neighborhood = block->getNeighborhood();
-      for( auto n = neighborhood.begin(); n != neighborhood.end(); ++n )
-         if( n->getProcess() != process )
-            neighbors.insert( n->getProcess() );
+      for(const auto & n : neighborhood)
+         if( n.getProcess() != process )
+            neighbors.insert( n.getProcess() );
    }
 
    neighborhood_.clear();
-   for( auto n = neighbors.begin(); n != neighbors.end(); ++n )
-      neighborhood_.push_back( *n );
+   for(uint_t neighbor : neighbors)
+      neighborhood_.push_back( neighbor );
 }
 
 
@@ -575,13 +574,13 @@ void PhantomBlockForest::prepareMigration()
 
    const uint_t process = blockforest_.getProcess();
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
+   for(auto & block : blocks_)
    {
-      blockProcessMap[ process ][ it->first ] = it->second->getTargetProcess();
-      auto & neighbors = it->second->getNeighborhood();
-      for( auto n = neighbors.begin(); n != neighbors.end(); ++n )
-         if( n->getProcess() != process )
-            ranksToRecvFrom.insert( numeric_cast< mpi::MPIRank >( n->getProcess() ) );
+      blockProcessMap[ process ][ block.first ] = block.second->getTargetProcess();
+      auto & neighbors = block.second->getNeighborhood();
+      for(const auto & neighbor : neighbors)
+         if( neighbor.getProcess() != process )
+            ranksToRecvFrom.insert( numeric_cast< mpi::MPIRank >( neighbor.getProcess() ) );
    }
    WALBERLA_ASSERT( ( blocks_.empty() && blockProcessMap.empty() ) || ( blockProcessMap.size() == uint_t(1) ) );
 
@@ -589,10 +588,10 @@ void PhantomBlockForest::prepareMigration()
    mpi::BufferSystem bufferSystem( MPIManager::instance()->comm(), 1943 ); // phantomblockforest = 112 104 97 110 116 111 109 98 108 111 99 107 102 111 114 101 115 116 + 2
    bufferSystem.setReceiverInfo( ranksToRecvFrom, true ); // true = the size of a message from A to B varies
 
-   for( auto rank = ranksToRecvFrom.begin(); rank != ranksToRecvFrom.end(); ++rank )
+   for(int rank : ranksToRecvFrom)
    {
-      WALBERLA_ASSERT_UNEQUAL( uint_c(*rank), process );
-      bufferSystem.sendBuffer( *rank ) << blockProcessMap[ process ];
+      WALBERLA_ASSERT_UNEQUAL( uint_c(rank), process );
+      bufferSystem.sendBuffer( rank ) << blockProcessMap[ process ];
    }
 
    bufferSystem.sendAll();
@@ -604,9 +603,9 @@ void PhantomBlockForest::prepareMigration()
       recvIt.buffer() >> blockProcessMap[ uint_c( recvIt.rank() ) ];
    }
 
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
+   for(auto & it : blocks_)
    {
-      auto & block = it->second;
+      auto & block = it.second;
       for( uint_t n = uint_t(0); n != block->getNeighborhoodSize(); ++n )
       {
          const uint_t p = block->getNeighborProcess(n);
@@ -624,20 +623,20 @@ void PhantomBlockForest::prepareMigration()
    ranksToRecvFrom.clear();
 
    const auto & blocks = blockforest_.getBlockMap();
-   for( auto it = blocks.begin(); it != blocks.end(); ++it )
+   for(const auto & block : blocks)
    {
-      auto & targets = it->second->getTargetProcess();
-      for( auto tp = targets.begin(); tp != targets.end(); ++tp )
-         if( *tp != process )
-            ranksToRecvFrom.insert( numeric_cast< mpi::MPIRank >( *tp ) );
+      auto & targets = block.second->getTargetProcess();
+      for(uint_t target : targets)
+         if( target != process )
+            ranksToRecvFrom.insert( numeric_cast< mpi::MPIRank >( target ) );
    }
    
    mpi::BufferSystem linkBufferSystem( MPIManager::instance()->comm(), 1945 ); // phantomblockforest = 112 104 97 110 116 111 109 98 108 111 99 107 102 111 114 101 115 116 + 4
    linkBufferSystem.setReceiverInfo( ranksToRecvFrom, true ); // true = the size of a message from A to B varies
    
-   for( auto it = blocks_.begin(); it != blocks_.end(); ++it )
+   for(auto & it : blocks_)
    {
-      auto & block = it->second;
+      auto & block = it.second;
       auto & id = block->getId();
       auto & sources = block->getSourceProcess();
       
diff --git a/src/blockforest/SetupBlock.cpp b/src/blockforest/SetupBlock.cpp
index 7924a61ba14b4f5fdb1ddc26f6852c6efd83605d..56ae44fa92edf22787eb92b2aaa9a1f52ca10af3 100644
--- a/src/blockforest/SetupBlock.cpp
+++ b/src/blockforest/SetupBlock.cpp
@@ -36,9 +36,9 @@ void SetupBlock::assembleNeighborhood() {
    std::set< SetupBlock* > neighborhood;
 
    for( uint_t n = 0; n != 26; ++n )
-      for( uint_t i = 0; i != neighborhoodSection_[n].size(); ++i )
-         if( neighborhood.insert( neighborhoodSection_[n][i] ).second )
-            neighborhood_.push_back( neighborhoodSection_[n][i] );
+      for(auto block : neighborhoodSection_[n])
+         if( neighborhood.insert(block ).second )
+            neighborhood_.push_back(block );
 }
 
 
diff --git a/src/blockforest/SetupBlock.h b/src/blockforest/SetupBlock.h
index f700743fa3d8d8e619458567e2f887af1dd3e083..00dcc5b0dddec2a9564d3e9120cf4bd153d643a1 100644
--- a/src/blockforest/SetupBlock.h
+++ b/src/blockforest/SetupBlock.h
@@ -49,7 +49,7 @@ public:
                       const real_t xmax, const real_t ymax, const real_t zmax, // excl.
                       const uint_t level );
 
-   ~SetupBlock() { for( uint_t i = 0; i != children_.size(); ++i ) delete children_[i]; }
+   ~SetupBlock() { for(auto & child : children_) delete child; }
 
    const BlockID& getId()            const { return Id_; }
          uint_t   getProcess()       const { return process_; }
diff --git a/src/blockforest/SetupBlockForest.cpp b/src/blockforest/SetupBlockForest.cpp
index b8d454d45c9d1ddc921343e98bca41db609642eb..b8c0833b7067cbf5b744b7f2c5ad8ad3d9546cc2 100644
--- a/src/blockforest/SetupBlockForest.cpp
+++ b/src/blockforest/SetupBlockForest.cpp
@@ -72,14 +72,14 @@ uint_t SetupBlockForest::getNumberOfBlocks( const uint_t level ) const
 
    uint_t count( uint_t(0) );
 
-   for( uint_t i = 0; i != forest_.size(); ++i ) {
+   for(auto coarseBlock : forest_) {
 
-      if( forest_[i] == nullptr )
+      if(coarseBlock == nullptr )
          continue;
 
       std::stack< SetupBlock* > stack;
 
-      stack.push( forest_[i] );
+      stack.push(coarseBlock );
 
       while( !stack.empty() ) {
 
@@ -293,16 +293,16 @@ void SetupBlockForest::getBlocks( std::vector< const SetupBlock* >& blocks ) con
 
    // ATTENTION: the vector 'blocks' is not emptied
 
-   for( uint_t i = 0; i != forest_.size(); ++i ) {
+   for(auto coarseBlock : forest_) {
 
-      if( forest_[i] == nullptr )
+      if(coarseBlock == nullptr )
          continue;
 
       // depth-first search
 
       std::stack< SetupBlock* > stack;
 
-      stack.push( forest_[i] );
+      stack.push(coarseBlock );
 
       while( !stack.empty() ) {
 
@@ -326,16 +326,16 @@ void SetupBlockForest::getBlocks( std::vector< SetupBlock* >& blocks ) {
 
    // ATTENTION: the vector 'blocks' is not emptied
 
-   for( uint_t i = 0; i != forest_.size(); ++i ) {
+   for(auto & coarseBlock : forest_) {
 
-      if( forest_[i] == nullptr )
+      if(coarseBlock == nullptr )
          continue;
 
       // depth-first search
 
       std::stack< SetupBlock* > stack;
 
-      stack.push( forest_[i] );
+      stack.push(coarseBlock );
 
       while( !stack.empty() ) {
 
@@ -359,14 +359,14 @@ void SetupBlockForest::getBlocks( std::vector< const SetupBlock* >& blocks, cons
 
    // ATTENTION: the vector 'blocks' is not emptied
 
-   for( uint_t i = 0; i != forest_.size(); ++i ) {
+   for(auto coarseBlock : forest_) {
 
-      if( forest_[i] == nullptr )
+      if(coarseBlock == nullptr )
          continue;
 
       std::stack< SetupBlock* > stack;
 
-      stack.push( forest_[i] );
+      stack.push(coarseBlock );
 
       while( !stack.empty() ) {
 
@@ -390,14 +390,14 @@ void SetupBlockForest::getBlocks( std::vector< SetupBlock* >& blocks, const uint
 
    // ATTENTION: the vector 'blocks' is not emptied
 
-   for( uint_t i = 0; i != forest_.size(); ++i ) {
+   for(auto & coarseBlock : forest_) {
 
-      if( forest_[i] == nullptr )
+      if(coarseBlock == nullptr )
          continue;
 
       std::stack< SetupBlock* > stack;
 
-      stack.push( forest_[i] );
+      stack.push(coarseBlock );
 
       while( !stack.empty() ) {
 
@@ -486,8 +486,8 @@ void SetupBlockForest::getProcessSpecificBlocks( std::vector< const SetupBlock*
 
    const std::vector< SetupBlock* >& processBlocks = blockDistribution_[ process ];
 
-   for( uint_t i = 0; i < processBlocks.size(); ++i )
-      blocks.push_back( processBlocks[i] );
+   for(auto processBlock : processBlocks)
+      blocks.push_back( processBlock );
 }
 
 
@@ -698,8 +698,8 @@ void SetupBlockForest::init( const AABB& domain, const uint_t xSize, const uint_
                       "(xSize (= " << xSize << ") * ySize (= " << ySize << ") * zSize (= " << zSize << "))!" )
 
    if( !forest_.empty() ) {
-      for( uint_t i = 0; i != forest_.size(); ++i ) {
-         if( forest_[i] != nullptr ) delete forest_[i];
+      for(auto & coarseBlock : forest_) {
+         if(coarseBlock != nullptr ) delete coarseBlock;
       }
       forest_.clear();
    }
@@ -744,8 +744,8 @@ void SetupBlockForest::init( const AABB& domain, const uint_t xSize, const uint_
    if( !rootBlockExclusionFunctions.empty() )
       WALBERLA_LOG_PROGRESS( "Initializing SetupBlockForest: Calling root block exclusion callback functions ..." )
 
-   for( uint_t i = 0; i != rootBlockExclusionFunctions.size(); ++i )
-      rootBlockExclusionFunctions[i]( excludeBlock, rootBlockAABB );
+   for(const auto & rootBlockExclusionFunction : rootBlockExclusionFunctions)
+      rootBlockExclusionFunction( excludeBlock, rootBlockAABB );
 
    // creation of all root blocks
 
@@ -865,8 +865,8 @@ void SetupBlockForest::createForest( const Set<SUID>& selector ) {
 
       // MARK ALL BLOCKS THAT NEED TO BE SPLIT
 
-      for( uint_t i = 0; i < refinementSelectionFunctions.size(); ++i )
-         refinementSelectionFunctions[i]( *this );
+      for(const auto & refinementSelectionFunction : refinementSelectionFunctions)
+         refinementSelectionFunction( *this );
 
       // GET ALL BLOCKS (= ALL LEAVES)
 
@@ -901,8 +901,8 @@ void SetupBlockForest::createForest( const Set<SUID>& selector ) {
       // IDENTIFY ALL BLOCKS THAT ARE MARKED TO BE SPLIT
 
       std::vector< SetupBlock* > blocksToSplit;
-      for( uint_t i = 0; i < blocks.size(); ++i )
-         if( blocks[i]->isMarked() ) blocksToSplit.push_back( blocks[i] );
+      for(auto & block : blocks)
+         if( block->isMarked() ) blocksToSplit.push_back( block );
 
       numberOfBlocks_ += blocksToSplit.size() * 7;
 
@@ -938,9 +938,9 @@ void SetupBlockForest::createForest( const Set<SUID>& selector ) {
          WALBERLA_LOG_PROGRESS( "Initializing SetupBlockForest: Calling block exclusion callback functions on child blocks ..." )
          for( uint_t c = 0; c != 8; ++c )
          {
-            for( uint_t j = 0; j != blockExclusionFunctions.size(); ++j )
+            for(const auto & blockExclusionFunction : blockExclusionFunctions)
             {
-               if(blockExclusionFunctions[j]( *blocksToSplit[ uint_c(i) ]->getChild(c)))
+               if(blockExclusionFunction( *blocksToSplit[ uint_c(i) ]->getChild(c)))
                {
                   WALBERLA_LOG_DETAIL( "Initializing SetupBlockForest: Excluding child block with ID " << blocksToSplit[ uint_c(i) ]->getChild(c)->getId() <<
                                       "\n                               - AABB: " << blocksToSplit[ uint_c(i) ]->getChild(c)->getAABB() <<
@@ -956,9 +956,7 @@ void SetupBlockForest::createForest( const Set<SUID>& selector ) {
 
       std::set< SetupBlock* > blocksToUpdate;
 
-      for( uint_t i = 0; i < blocksToSplit.size(); ++i ) {
-
-         SetupBlock* const block = blocksToSplit[i];
+      for(auto block : blocksToSplit) {
 
          for( uint_t c = 0; c != 8; ++c )
          {
@@ -1071,9 +1069,9 @@ void SetupBlockForest::updateNeighborhood( std::vector< SetupBlock* >& blocks )
                WALBERLA_ASSERT_LESS_EQUAL( neighborhoodSectionBlocks.size(), 1 )
             }
 #endif
-            for( uint_t j = 0; j != neighborhoodSectionBlocks.size(); ++j )
-               if(neighborhoodSectionBlocks[j] != nullptr)
-                  block->addNeighbor( n, neighborhoodSectionBlocks[j] );
+            for(auto & neighborhoodSectionBlock : neighborhoodSectionBlocks)
+               if(neighborhoodSectionBlock != nullptr)
+                  block->addNeighbor( n, neighborhoodSectionBlock );
          }
 
          neighborhoodSectionBlocks.clear();
@@ -1146,8 +1144,8 @@ void SetupBlockForest::createNeighborhood() {
                WALBERLA_ASSERT_EQUAL( neighborhoodSectionBlocks.size(), 1 )
             }
 #endif
-            for( uint_t j = 0; j != neighborhoodSectionBlocks.size(); ++j )
-               block->addNeighbor( n, neighborhoodSectionBlocks[j] );
+            for(auto & neighborhoodSectionBlock : neighborhoodSectionBlocks)
+               block->addNeighbor( n, neighborhoodSectionBlock );
          }
 
          neighborhoodSectionBlocks.clear();
@@ -1192,8 +1190,8 @@ void SetupBlockForest::assignAllBlocksToRootProcess()
    std::vector< SetupBlock* > blocks;
    getBlocks( blocks );
 
-   for( uint_t i = 0; i != blocks.size(); ++i )
-      blocks[i]->assignTargetProcess( uint_c(0) );
+   for(auto & block : blocks)
+      block->assignTargetProcess( uint_c(0) );
 
    calculateProcessDistributionFinalization();
 }
@@ -1395,9 +1393,9 @@ void SetupBlockForest::calculateProcessDistribution_LevelwiseMetis( const uint_t
       else
       {
          uint_t targetProcess = 0;
-         for( auto blockIt = blocks.begin(); blockIt != blocks.end(); ++blockIt )
+         for(auto & block : blocks)
          {
-            (*blockIt)->assignTargetProcess( targetProcess++ );
+            block->assignTargetProcess( targetProcess++ );
          }
 
       }
@@ -1484,16 +1482,16 @@ void SetupBlockForest::calculateProcessDistribution_Greedy( const uint_t   numbe
       distributition.insert( distributition.end(), i );
 
    numberOfWorkerProcesses = 0;
-   for( auto block = blocks.begin(); block != blocks.end(); ++block )
+   for(auto & block : blocks)
    {
       auto process = distributition.begin();
       while( process != distributition.end() )
       {
-         if( memory[ *process ] + (*block)->getMemory() <= memoryLimit )
+         if( memory[ *process ] + block->getMemory() <= memoryLimit )
          {
-            workload[ *process ] += (*block)->getWorkload();
-            memory[ *process ]   += (*block)->getMemory();
-            (*block)->assignTargetProcess( *process );
+            workload[ *process ] += block->getWorkload();
+            memory[ *process ]   += block->getMemory();
+            block->assignTargetProcess( *process );
             WALBERLA_ASSERT_LESS_EQUAL( *process, numberOfWorkerProcesses )
             numberOfWorkerProcesses = std::max( numberOfWorkerProcesses, *process + uint_c(1) );
             break;
@@ -1551,10 +1549,10 @@ void SetupBlockForest::balanceLoadHelper( const TargetProcessAssignmentFunction
 
    std::vector< bool > processHasBlocks( numberOfWorkerProcesses, false );
 
-   for( auto block = blocks.begin(); block != blocks.end(); ++block )
+   for(auto & block : blocks)
    {
-      WALBERLA_CHECK_LESS( (*block)->getTargetProcess(), numberOfWorkerProcesses )
-      processHasBlocks[ (*block)->getTargetProcess() ] = true;
+      WALBERLA_CHECK_LESS( block->getTargetProcess(), numberOfWorkerProcesses )
+      processHasBlocks[ block->getTargetProcess() ] = true;
    }
 
    for( auto it = processHasBlocks.begin(); it != processHasBlocks.end(); ++it )
@@ -1565,14 +1563,14 @@ void SetupBlockForest::balanceLoadHelper( const TargetProcessAssignmentFunction
    if( perProcessMemoryLimit > memory_t(0) )
    {
       std::vector< memory_t > memory( numberOfWorkerProcesses, memory_c(0) );
-      for( auto block = blocks.begin(); block != blocks.end(); ++block )
+      for(auto & block : blocks)
       {
-         const uint_t targetProcess = (*block)->getTargetProcess();
-         if( memory[ targetProcess ] + (*block)->getMemory() > perProcessMemoryLimit )
+         const uint_t targetProcess = block->getTargetProcess();
+         if( memory[ targetProcess ] + block->getMemory() > perProcessMemoryLimit )
             WALBERLA_ABORT( "Load balancing failed: A distribution to " << numberOfProcesses << " processes given a memory limit of \"" << perProcessMemoryLimit <<
                             "\" is impossible.\n                       (Are the memory coefficients correctly assigned to all blocks via "
                             "a callback function that was registered with \"addWorkloadMemorySUIDAssignmentFunction()\"?)" )
-         memory[ targetProcess ] += (*block)->getMemory();
+         memory[ targetProcess ] += block->getMemory();
       }
    }
 
@@ -1646,15 +1644,15 @@ void SetupBlockForest::calculateProcessDistributionFinalization( const bool reor
 
    blockDistribution_.clear();
    blockDistribution_.resize( numberOfProcesses_ );
-   for( uint_t i = 0; i != blocks.size(); ++i )
-      blockDistribution_[ blocks[i]->getProcess() ].push_back( blocks[i] );
+   for(auto & block : blocks)
+      blockDistribution_[ block->getProcess() ].push_back( block );
 
 #ifndef NDEBUG
    std::vector< bool > processHasBlocks( numberOfProcesses_, false );
 
-   for( uint_t i = 0; i != blocks.size(); ++i ) {
-      WALBERLA_ASSERT_LESS( blocks[i]->getProcess(), numberOfProcesses_ )
-      processHasBlocks[ blocks[i]->getProcess() ] = true;
+   for(auto & block : blocks) {
+      WALBERLA_ASSERT_LESS( block->getProcess(), numberOfProcesses_ )
+      processHasBlocks[ block->getProcess() ] = true;
    }
 
    for( uint_t i = 0; i != numberOfProcesses_; ++i )
@@ -1695,15 +1693,15 @@ void SetupBlockForest::saveToFile( const char* const filename ) const {
 
    // number of coarse/root blocks in each direction
 
-   for( uint_t i = 0; i != 3; ++i ) {
-      uintToByteArray( size_[i], buffer, offset, 4 );
+   for(uint_t i : size_) {
+      uintToByteArray( i, buffer, offset, 4 );
       offset += 4;
    }
 
    // domain periodicity
 
-   for( uint_t i = 0; i != 3; ++i ) {
-      uintToByteArray( periodic_[i] ? uint_c(1) : uint_c(0), buffer, offset, 1 );
+   for(bool i : periodic_) {
+      uintToByteArray( i ? uint_c(1) : uint_c(0), buffer, offset, 1 );
       ++offset;
    }
 
@@ -1741,8 +1739,8 @@ void SetupBlockForest::saveToFile( const char* const filename ) const {
    Set<SUID> suids;
 
    for( uint_t i = 0; i != numberOfProcesses_; ++i ) {
-      for( uint_t j = 0; j != blockDistribution_[i].size(); ++j )
-         suids += blockDistribution_[i][j]->getState();
+      for(auto j : blockDistribution_[i])
+         suids += j->getState();
    }
 
    // number of SUIDs
@@ -1762,15 +1760,15 @@ void SetupBlockForest::saveToFile( const char* const filename ) const {
    // for every SUID ...
 
    uint_t i = 0;
-   for( Set<SUID>::const_iterator it = suids.begin(); it != suids.end(); ++it ) {
+   for(auto suid : suids) {
 
       std::vector< bool > suidBoolVec( 8 * suidBytes );
       suidBoolVec[i] =  true;
-      suidMap[ *it ] = suidBoolVec;
+      suidMap[ suid ] = suidBoolVec;
 
       // length of its identifier string
 
-      const uint_t length = it->getIdentifier().length();
+      const uint_t length = suid.getIdentifier().length();
       WALBERLA_CHECK_LESS( length, 256, "SUID identifiers are allowed to consist of 255 characters at most when saving the block structure to file!" )
 
       buffer.resize( 1 + length );
@@ -1778,7 +1776,7 @@ void SetupBlockForest::saveToFile( const char* const filename ) const {
 
       // the identifier string
 
-      const char* str = it->getIdentifier().c_str();
+      const char* str = suid.getIdentifier().c_str();
       for( uint_t j = 0; j != length; ++j )
          buffer[1+j] = *reinterpret_cast< const uint8_t* >( str + j );
 
@@ -1832,11 +1830,11 @@ void SetupBlockForest::saveToFile( const char* const filename ) const {
                std::vector< bool > suidBoolVec( 8 * suidBytes );
 
                const Set<SUID>& state = block->getState();
-               for( Set<SUID>::const_iterator suid = state.begin(); suid != state.end(); ++suid ) {
-                  WALBERLA_ASSERT( suidMap.find( *suid ) != suidMap.end() );
+               for(auto suid : state) {
+                  WALBERLA_ASSERT( suidMap.find( suid ) != suidMap.end() );
                   //Elementwise OR of all elements
                   for (uint_t k = 0;k  < suidBoolVec.size(); ++k) {
-                     suidBoolVec[k] = suidBoolVec[k] || suidMap.find( *suid )->second[k];
+                     suidBoolVec[k] = suidBoolVec[k] || suidMap.find( suid )->second[k];
                   }
                }
 
@@ -1874,8 +1872,8 @@ void SetupBlockForest::saveToFile( const char* const filename ) const {
       uintToByteArray( uint_c( neighbors.size() ), buffer, offset, 2 );
       offset += 2;
 
-      for( std::set< uint_t >::iterator it = neighbors.begin(); it != neighbors.end(); ++it ) {
-         uintToByteArray( *it, buffer, offset, processIdBytes );
+      for(uint_t neighbor : neighbors) {
+         uintToByteArray( neighbor, buffer, offset, processIdBytes );
          offset += processIdBytes;
       }
 
@@ -1905,13 +1903,12 @@ void SetupBlockForest::writeVTKOutput( const std::string & filestem ) const
    std::vector< const SetupBlock* > blocks;
    getBlocks( blocks );
 
-   for( uint_t i = 0; i != blocks.size(); ++i )
-      if( blocks[i]->getMemory() > 0 ) ++allocatedBlocks;
+   for(auto & block : blocks)
+      if( block->getMemory() > 0 ) ++allocatedBlocks;
 
    outfile << "POINTS " << ( 8 * allocatedBlocks ) << " " << typeToString<real_t>() << "\n\n";
 
-   for( uint_t i = 0; i != blocks.size(); ++i ) {
-      const SetupBlock* const block = blocks[i];
+   for(auto block : blocks) {
       if( block->getMemory() > 0 ) {
          for( uint_t z = 0; z != 2; ++z ) {
             for( uint_t y = 0; y != 2; ++y ) {
@@ -1948,17 +1945,17 @@ void SetupBlockForest::writeVTKOutput( const std::string & filestem ) const
    outfile << "\n\nSCALARS workload double 1"
            <<   "\nLOOKUP_TABLE default\n";
 
-   for( uint_t i = 0; i != blocks.size(); ++i ) {
-      if( blocks[i]->getMemory() > 0 )
-         outfile << blocks[i]->getWorkload() << "\n";
+   for(auto & block : blocks) {
+      if( block->getMemory() > 0 )
+         outfile << block->getWorkload() << "\n";
    }
 
    outfile << "\n\nSCALARS process int 1"
            <<   "\nLOOKUP_TABLE default\n";
 
-   for( uint_t i = 0; i != blocks.size(); ++i ) {
-      if( blocks[i]->getMemory() > 0 )
-         outfile << blocks[i]->getProcess() << "\n";
+   for(auto & block : blocks) {
+      if( block->getMemory() > 0 )
+         outfile << block->getProcess() << "\n";
    }
 
 #ifdef WALBERLA_BLOCKFOREST_PRIMITIVE_BLOCKID
@@ -1966,9 +1963,9 @@ void SetupBlockForest::writeVTKOutput( const std::string & filestem ) const
    outfile << "\n\nSCALARS blockId unsigned_long 1"
            <<   "\nLOOKUP_TABLE default\n";
 
-   for( uint_t i = 0; i != blocks.size(); ++i ) {
-      if( blocks[i]->getMemory() > 0 )
-         outfile << blocks[i]->getId().getTreeId() << "\n";
+   for(auto & block : blocks) {
+      if( block->getMemory() > 0 )
+         outfile << block->getId().getTreeId() << "\n";
    }
 
 #endif // WALBERLA_BLOCKFOREST_PRIMITIVE_BLOCKID
@@ -1976,9 +1973,9 @@ void SetupBlockForest::writeVTKOutput( const std::string & filestem ) const
    outfile << "\n\nSCALARS level double 1"
            <<   "\nLOOKUP_TABLE colors\n";
 
-   for( uint_t i = 0; i != blocks.size(); ++i ) {
-      if( blocks[i]->getMemory() > 0 )
-         outfile << (( depth_ == 0 ) ? 0 : ( static_cast< double >( blocks[i]->getLevel() ) / static_cast< double >( depth_ ) )) << "\n";
+   for(auto & block : blocks) {
+      if( block->getMemory() > 0 )
+         outfile << (( depth_ == 0 ) ? 0 : ( static_cast< double >( block->getLevel() ) / static_cast< double >( depth_ ) )) << "\n";
    }
 
    outfile << "\n\nLOOKUP_TABLE colors " << ( depth_ + 1 );
@@ -2012,8 +2009,8 @@ void SetupBlockForest::writeCSV( const std::string & filestem ) const
       for( uint_t i = 0; i <= depth_; ++i )
       {
          uint_t n = uint_t(0);
-         for( auto block = blocks->begin(); block != blocks->end(); ++block )
-            if( (*block)->getLevel() == i ) ++n;
+         for(auto block : *blocks)
+            if( block->getLevel() == i ) ++n;
          outfile << "," << n;
       }
       outfile << "\n";
@@ -2028,8 +2025,8 @@ void SetupBlockForest::writeCSV( const std::string & filestem ) const
 void SetupBlockForest::toStream( std::ostream & os ) const
 {
    uint_t discardedRootBlocks = uint_t(0);
-   for( auto block = forest_.begin(); block != forest_.end(); ++block )
-      if( *block == nullptr ) ++discardedRootBlocks;
+   for(auto block : forest_)
+      if( block == nullptr ) ++discardedRootBlocks;
 
    os << "- AABB: " << domain_ << "\n"
       << "- initial decomposition: " << size_[0] << " x " << size_[1] << " x " << size_[2] << " (= forest size)\n"
@@ -2053,18 +2050,18 @@ void SetupBlockForest::toStream( std::ostream & os ) const
          std::vector< real_t > workload      ( depth_ + 2, real_t(0) );
          std::vector< uint_t > numberOfBlocks( depth_ + 2, uint_t(0) );
 
-         for( auto block = begin(); block != end(); ++block )
+         for(const auto & block : *this)
          {
-            const auto level = block->getLevel();
+            const auto level = block.getLevel();
 
-            space[ level ]          += block->getAABB().volume();
-            memory[ level ]         += real_c( block->getMemory() );
-            workload[ level ]       += real_c( block->getWorkload() );
+            space[ level ]          += block.getAABB().volume();
+            memory[ level ]         += real_c( block.getMemory() );
+            workload[ level ]       += real_c( block.getWorkload() );
             numberOfBlocks[ level ] += uint_t(1);
 
-            space.back()          += block->getAABB().volume();
-            memory.back()         += real_c( block->getMemory() );
-            workload.back()       += real_c( block->getWorkload() );
+            space.back()          += block.getAABB().volume();
+            memory.back()         += real_c( block.getMemory() );
+            workload.back()       += real_c( block.getWorkload() );
             numberOfBlocks.back() += uint_t(1);
          }
 
@@ -2095,17 +2092,17 @@ void SetupBlockForest::toStream( std::ostream & os ) const
          std::vector< memory_t >   processMemory  ( depth_ + 2, memory_t(0) );
          std::vector< workload_t > processWorkload( depth_ + 2, workload_t(0) );
 
-         for( auto block = process->begin(); block != process->end(); ++block )
+         for(auto block : *process)
          {
-            const auto level = (*block)->getLevel();
+            const auto level = block->getLevel();
 
             processBlocks[level]   += uint_t(1);
-            processMemory[level]   += (*block)->getMemory();
-            processWorkload[level] += (*block)->getWorkload();
+            processMemory[level]   += block->getMemory();
+            processWorkload[level] += block->getWorkload();
 
             processBlocks.back()   += uint_t(1);
-            processMemory.back()   += (*block)->getMemory();
-            processWorkload.back() += (*block)->getWorkload();
+            processMemory.back()   += block->getMemory();
+            processWorkload.back() += block->getWorkload();
          }
 
          for( uint_t i = 0; i < depth_ + 2; ++i )
@@ -2147,14 +2144,14 @@ void SetupBlockForest::toStream( std::ostream & os ) const
          std::vector< real_t > space( depth_ + 2, real_t(0) );
          std::vector< uint_t > numberOfBlocks( depth_ + 2, uint_t(0) );
 
-         for( auto block = begin(); block != end(); ++block )
+         for(const auto & block : *this)
          {
-            const auto level = block->getLevel();
+            const auto level = block.getLevel();
 
-            space[ level ] += block->getAABB().volume();
+            space[ level ] += block.getAABB().volume();
             numberOfBlocks[ level ] += uint_t(1);
 
-            space.back() += block->getAABB().volume();
+            space.back() += block.getAABB().volume();
             numberOfBlocks.back() += uint_t(1);
          }
 
diff --git a/src/blockforest/SetupBlockForest.h b/src/blockforest/SetupBlockForest.h
index 1d105148f1d1c6beff3114d70b26099528ede467..1834208749a71f7f4f5bde6c2e57a9bc52dc539c 100644
--- a/src/blockforest/SetupBlockForest.h
+++ b/src/blockforest/SetupBlockForest.h
@@ -420,9 +420,9 @@ inline SetupBlockForest::SetupBlockForest() {
 
 inline SetupBlockForest::~SetupBlockForest() {
 
-   for( uint_t i = 0; i != forest_.size(); ++i )
+   for(auto & coarseBlock : forest_)
    {
-      if( forest_[i] != nullptr ) delete forest_[i];
+      if(coarseBlock != nullptr ) delete coarseBlock;
    }
 }
 
@@ -623,8 +623,8 @@ inline void SetupBlockForest::initWorkloadMemorySUID( const Set<SUID>& selector
       WALBERLA_LOG_PROGRESS( "Initializing SetupBlockForest: Assigning workload, memory requirements, and SUIDs to blocks ..." )
    }
 
-   for( uint_t i = 0; i != workloadMemorySUIDAssignmentFunctions.size(); ++i )
-      workloadMemorySUIDAssignmentFunctions[i]( *this );
+   for(const auto & workloadMemorySUIDAssignmentFunction : workloadMemorySUIDAssignmentFunctions)
+      workloadMemorySUIDAssignmentFunction( *this );
 }
 
 
@@ -633,8 +633,8 @@ inline void SetupBlockForest::updateNeighborhood( std::set< SetupBlock* >& block
 
    std::vector< SetupBlock* > blocks;
 
-   for( auto it = blocksToUpdate.begin(); it != blocksToUpdate.end(); ++it )
-      blocks.push_back( *it );
+   for(auto it : blocksToUpdate)
+      blocks.push_back( it );
 
    updateNeighborhood( blocks );
 }
@@ -737,8 +737,8 @@ public:
 
    void operator()( SetupBlockForest & forest )
    {
-      for( auto function = function_.begin(); function != function_.end(); ++function )
-         (*function)( forest );
+      for(auto & function : function_)
+         function( forest );
    }
 
 private:
diff --git a/src/blockforest/communication/DirectionBasedReduceScheme.h b/src/blockforest/communication/DirectionBasedReduceScheme.h
index 138e3f7131c52306e57e0caa199f47913704fce8..9c4792e06eb8762c2f1231a33bb07c972bcd60ee 100644
--- a/src/blockforest/communication/DirectionBasedReduceScheme.h
+++ b/src/blockforest/communication/DirectionBasedReduceScheme.h
@@ -225,16 +225,16 @@ void DirectionBasedReduceScheme<dir_>::copyIntoMPIBuffers()
    {
       for( size_t nb = 0u; nb < localCopy_[b].size(); ++nb )
       {
-         for(size_t s = 0u; s < packInfos_.size(); ++s)
+         for(auto & packInfo : packInfos_)
          {
-            packInfos_[s]->communicateLocal( localBlocks_[b], localCopy_[b][nb], dir_ );
+            packInfo->communicateLocal( localBlocks_[b], localCopy_[b][nb], dir_ );
          }
       }
 
       for( size_t nb = 0u; nb < remoteSend_[b].size(); ++nb )
       {
          bool headerWritten = false;
-         for(size_t s = 0u; s < packInfos_.size(); ++s)
+         for(auto & packInfo : packInfos_)
          {
             //Packing of MPI Buffer
             uint_t rank,nx,ny,nz;
@@ -249,7 +249,7 @@ void DirectionBasedReduceScheme<dir_>::copyIntoMPIBuffers()
             }
 
             // Call Packer
-            packInfos_[s]->packData( localBlocks_[b], dir_, buffer );
+            packInfo->packData( localBlocks_[b], dir_, buffer );
          }
       }
    }
@@ -260,8 +260,8 @@ void DirectionBasedReduceScheme<dir_>::copyIntoMPIBuffers()
 template< stencil::Direction dir_ >
 void DirectionBasedReduceScheme<dir_>::copyFromMPIBuffers()
 {
-   for(size_t s = 0u; s < packInfos_.size(); ++s){
-      packInfos_[s]->reset();
+   for(auto & packInfo : packInfos_){
+      packInfo->reset();
    }
 
    //  --------  Loop over all incoming messages  -------------------------------------
@@ -277,10 +277,10 @@ void DirectionBasedReduceScheme<dir_>::copyFromMPIBuffers()
          // Get receiving block
          Block * rBlock = blockForest_->getBlockForest().getBlock(rBlockID);
 
-         for(size_t s = 0u; s < packInfos_.size(); ++s)
+         for(auto & packInfo : packInfos_)
          {
             // Call Unpacker
-            packInfos_[s]->unpackData( rBlock, stencil::inverseDir[dir_], buffer );
+            packInfo->unpackData( rBlock, stencil::inverseDir[dir_], buffer );
          }
       }
    }
diff --git a/src/blockforest/communication/UniformBufferedScheme.h b/src/blockforest/communication/UniformBufferedScheme.h
index e7cbd6c631ad0751f486ab4071aee310d58ef06f..549e8b3213ca178dd966f6c5be678cf6e1c49ae6 100644
--- a/src/blockforest/communication/UniformBufferedScheme.h
+++ b/src/blockforest/communication/UniformBufferedScheme.h
@@ -253,15 +253,15 @@ void UniformBufferedScheme<Stencil>::startCommunication()
 
    communicationInProgress_ = true;
 
-   for( auto packInfo = packInfos_.begin(); packInfo != packInfos_.end(); ++packInfo )
-      ( *packInfo )->beforeStartCommunication();
+   for(auto & packInfo : packInfos_)
+      packInfo->beforeStartCommunication();
 
    bool constantSizes = true;
    bool threadsafeReceive = true;
-   for( auto packInfo = packInfos_.begin(); packInfo != packInfos_.end(); ++packInfo )
+   for(auto & packInfo : packInfos_)
    {
-      if( !( *packInfo )->constantDataExchange() ) constantSizes = false;
-      if( !( *packInfo )->threadsafeReceiving()  ) threadsafeReceive = false;
+      if( !packInfo->constantDataExchange() ) constantSizes = false;
+      if( !packInfo->threadsafeReceiving()  ) threadsafeReceive = false;
    }
 
    // Redo setup if a PackInfo has changed its requirements
@@ -311,7 +311,7 @@ void UniformBufferedScheme<Stencil>::startCommunication()
                auto neighbor = dynamic_cast< Block * >( forest->getBlock(nBlockId) );
                WALBERLA_ASSERT_EQUAL( neighbor->getProcess(), block->getProcess() );
 
-               for( auto packInfo = packInfos_.begin(); packInfo != packInfos_.end(); ++packInfo )
+               for(auto & packInfo : packInfos_)
                {
                   if( localMode_ == BUFFER )
                   {
@@ -320,14 +320,14 @@ void UniformBufferedScheme<Stencil>::startCommunication()
                      const uint_t index = uint_c( localBuffers_.size() ) - uint_t(1);
 
                      VoidFunction pack = std::bind( &UniformBufferedScheme<Stencil>::localBufferPacking, this,
-                                                      index, std::cref( *packInfo ), block, *dir );
+                                                      index, std::cref( packInfo ), block, *dir );
 
                      threadsafeLocalCommunication_.push_back( pack );
 
                      VoidFunction unpack = std::bind( &UniformBufferedScheme<Stencil>::localBufferUnpacking, this,
-                                                        index, std::cref( *packInfo ), neighbor, *dir  );
+                                                        index, std::cref( packInfo ), neighbor, *dir  );
 
-                     if( (*packInfo)->threadsafeReceiving() )
+                     if( packInfo->threadsafeReceiving() )
                         threadsafeLocalCommunicationUnpack_.push_back( unpack );
                      else
                         localCommunicationUnpack_.push_back( unpack );
@@ -335,8 +335,8 @@ void UniformBufferedScheme<Stencil>::startCommunication()
                   else
                   {
                      VoidFunction localCommunicationFunction = std::bind( &walberla::communication::UniformPackInfo::communicateLocal,
-                                                                            *packInfo, block, neighbor, *dir );
-                     if( (*packInfo)->threadsafeReceiving() )
+                                                                            packInfo, block, neighbor, *dir );
+                     if( packInfo->threadsafeReceiving() )
                         threadsafeLocalCommunication_.push_back( localCommunicationFunction );
                      else
                         localCommunication_.push_back( localCommunicationFunction );
@@ -350,9 +350,9 @@ void UniformBufferedScheme<Stencil>::startCommunication()
                if( !packInfos_.empty() )
                   sendFunctions[ nProcess ].push_back( std::bind( UniformBufferedScheme<Stencil>::writeHeader, std::placeholders::_1, nBlockId, *dir ) );
 
-               for( auto packInfo = packInfos_.begin(); packInfo != packInfos_.end(); ++packInfo )
+               for(auto & packInfo : packInfos_)
                   sendFunctions[ nProcess ].push_back( std::bind( &walberla::communication::UniformPackInfo::packData,
-                                                                     *packInfo, block, *dir,  std::placeholders::_1 ) );
+                                                                     packInfo, block, *dir,  std::placeholders::_1 ) );
             }
          }
       }
@@ -382,8 +382,8 @@ void UniformBufferedScheme<Stencil>::startCommunication()
    
    if( localMode_ == START )
    {
-      for( auto function = localCommunication_.begin(); function != localCommunication_.end(); ++function )
-         (*function)();
+      for(auto & function : localCommunication_)
+         function();
 
       const int threadsafeLocalCommunicationSize = int_c( threadsafeLocalCommunication_.size() );
 #ifdef _OPENMP
@@ -402,8 +402,8 @@ void UniformBufferedScheme<Stencil>::startCommunication()
          threadsafeLocalCommunication_[uint_c(i)]();
    }
 
-   for( auto packInfo = packInfos_.begin(); packInfo != packInfos_.end(); ++packInfo )
-      ( *packInfo )->afterStartCommunication();
+   for(auto & packInfo : packInfos_)
+      packInfo->afterStartCommunication();
 }
 
 
@@ -414,15 +414,15 @@ void UniformBufferedScheme<Stencil>::wait()
    if( packInfos_.empty() || !communicationInProgress_ )
       return;
 
-   for( auto packInfo = packInfos_.begin(); packInfo != packInfos_.end(); ++packInfo )
-      (*packInfo)->beforeWait();
+   for(auto & packInfo : packInfos_)
+      packInfo->beforeWait();
 
    // LOCAL
 
    if( localMode_ == WAIT )
    {
-      for( auto function = localCommunication_.begin(); function != localCommunication_.end(); ++function )
-         (*function)();
+      for(auto & function : localCommunication_)
+         function();
 
       const int threadsafeLocalCommunicationSize = int_c( threadsafeLocalCommunication_.size() );
 #ifdef _OPENMP
@@ -433,8 +433,8 @@ void UniformBufferedScheme<Stencil>::wait()
    }
    else if( localMode_ == BUFFER )
    {
-      for( auto function = localCommunicationUnpack_.begin(); function != localCommunicationUnpack_.end(); ++function )
-         (*function)();
+      for(auto & function : localCommunicationUnpack_)
+         function();
 
       const int threadsafeLocalCommunicationUnpackSize = int_c( threadsafeLocalCommunicationUnpack_.size() );
 #ifdef _OPENMP
@@ -448,8 +448,8 @@ void UniformBufferedScheme<Stencil>::wait()
 
    bufferSystem_.wait();
 
-   for( auto packInfo = packInfos_.begin(); packInfo != packInfos_.end(); ++packInfo )
-      ( *packInfo )->afterWait();
+   for(auto & packInfo : packInfos_)
+      packInfo->afterWait();
 
    communicationInProgress_ = false;
 }
@@ -477,8 +477,8 @@ void UniformBufferedScheme<Stencil>::readHeader( RecvBuffer & buffer, BlockID &
 template< typename Stencil >
 void UniformBufferedScheme<Stencil>::send( SendBuffer & buffer, std::vector< SendBufferFunction > & functions )
 {
-   for( auto function = functions.begin(); function != functions.end(); ++function )
-      (*function)( buffer );
+   for(auto & function : functions)
+      function( buffer );
 }
 
 
@@ -500,8 +500,8 @@ void UniformBufferedScheme<Stencil>::receive( RecvBuffer & buffer )
 
          auto block = dynamic_cast< Block * >( forest->getBlock(blockID) );
 
-         for( auto packInfo = packInfos_.begin(); packInfo != packInfos_.end(); ++packInfo )
-            (*packInfo)->unpackData( block, stencil::inverseDir[dir], buffer );
+         for(auto & packInfo : packInfos_)
+            packInfo->unpackData( block, stencil::inverseDir[dir], buffer );
       }
    }
 }
diff --git a/src/blockforest/loadbalancing/Cartesian.cpp b/src/blockforest/loadbalancing/Cartesian.cpp
index 4645286d55e015d92a79486f45c7dd24279b9390..9ea374432c8bf1d17afc87fbb5315f45e925d807 100644
--- a/src/blockforest/loadbalancing/Cartesian.cpp
+++ b/src/blockforest/loadbalancing/Cartesian.cpp
@@ -80,11 +80,11 @@ uint_t CartesianDistribution::operator()( SetupBlockForest & forest, const uint_
 
             forest.getBlocks( partitionBlocks, indices[0][x], indices[1][y], indices[2][z], indices[0][x+1], indices[1][y+1], indices[2][z+1] );
 
-            for( auto block = partitionBlocks.begin(); block != partitionBlocks.end(); ++block )
+            for(auto & partitionBlock : partitionBlocks)
             {
                const uint_t index = z * partitions[0] * partitions[1] + y * partitions[0] + x;
 
-               (*block)->assignTargetProcess( ( !processIdMap_->empty() ) ? (*processIdMap_)[ index ] : index );
+               partitionBlock->assignTargetProcess( ( !processIdMap_->empty() ) ? (*processIdMap_)[ index ] : index );
             }
          }
       }
diff --git a/src/blockforest/loadbalancing/DynamicCurve.h b/src/blockforest/loadbalancing/DynamicCurve.h
index 6b6c9736612a0b4181112363624e559e1fd1e3fc..aa875eec4570ca08e0979ea59003ab89fbf1bd7f 100644
--- a/src/blockforest/loadbalancing/DynamicCurve.h
+++ b/src/blockforest/loadbalancing/DynamicCurve.h
@@ -239,10 +239,10 @@ void DynamicCurveBalance< PhantomData_T >::allGatherWeighted( std::vector< std::
 {  
    std::vector< std::pair< BlockID, weight_t > > localBlocks;
 
-   for( auto it = targetProcess.begin(); it != targetProcess.end(); ++it )
+   for(auto & processIt : targetProcess)
    {
-      weight_t weight = it->first->template getData< PhantomData_T >().weight();
-      localBlocks.push_back( std::make_pair( it->first->getId(), weight ) );
+      weight_t weight = processIt.first->template getData< PhantomData_T >().weight();
+      localBlocks.push_back( std::make_pair(processIt.first->getId(), weight ) );
    }
    
    mpi::SendBuffer sendBuffer;
@@ -285,8 +285,8 @@ void DynamicCurveBalance< PhantomData_T >::allGatherNoWeight( std::vector< std::
 {
    std::vector< BlockID > localBlocks;
 
-   for( auto it = targetProcess.begin(); it != targetProcess.end(); ++it )
-      localBlocks.push_back( it->first->getId() );
+   for(auto & processIt : targetProcess)
+      localBlocks.push_back(processIt.first->getId() );
    
    mpi::SendBuffer sendBuffer;
    mpi::RecvBuffer recvBuffer;
@@ -328,10 +328,10 @@ void DynamicCurveBalance< PhantomData_T >::masterWeighted( std::vector< std::pai
 {
    std::vector< std::pair< BlockID, weight_t > > localBlocks;
 
-   for( auto it = targetProcess.begin(); it != targetProcess.end(); ++it )
+   for(auto & processIt : targetProcess)
    {
-      weight_t weight = it->first->template getData< PhantomData_T >().weight();
-      localBlocks.push_back( std::make_pair( it->first->getId(), weight ) );
+      weight_t weight = processIt.first->template getData< PhantomData_T >().weight();
+      localBlocks.push_back( std::make_pair(processIt.first->getId(), weight ) );
    } 
    
    std::set< mpi::MPIRank > ranksToRecvFrom;
@@ -405,8 +405,8 @@ void DynamicCurveBalance< PhantomData_T >::masterNoWeight( std::vector< std::pai
 {
    std::vector< BlockID > localBlocks;
 
-   for( auto it = targetProcess.begin(); it != targetProcess.end(); ++it )
-      localBlocks.push_back( it->first->getId() );
+   for(auto & processIt : targetProcess)
+      localBlocks.push_back(processIt.first->getId() );
    
    std::set< mpi::MPIRank > ranksToRecvFrom;
 
@@ -776,10 +776,8 @@ void DynamicCurveBalance< PhantomData_T >::balanceWeighted( const std::vector< s
    for( uint_t p = uint_t(0); p != processes; ++p )
       targets[p].resize( allBlocks[p].size() );
    
-   for( uint_t i = 0; i < blocksPerLevel.size(); ++i )
+   for(const auto & blocks : blocksPerLevel)
    {
-      const std::vector< std::pair< pid_t, idx_t > > & blocks = blocksPerLevel[i];
-      
       long double totalWeight( 0 );
       for( auto block = blocks.begin(); block != blocks.end(); ++block )
       {
@@ -831,10 +829,8 @@ void DynamicCurveBalance< PhantomData_T >::balanceNoWeight( const std::vector< s
    for( uint_t p = uint_t(0); p != processes; ++p )
       targets[p].resize( allBlocks[p].size() );
    
-   for( uint_t i = 0; i < blocksPerLevel.size(); ++i )
+   for(const auto & blocks : blocksPerLevel)
    {
-      const std::vector< std::pair< pid_t, idx_t > > & blocks = blocksPerLevel[i];
-
       const uint_t base = uint_c( blocks.size() ) / processes;
       const uint_t rest = uint_c( blocks.size() ) % processes;
 
@@ -934,8 +930,8 @@ void DynamicCurveBalance< PhantomData_T >::finalAssignment( const uint_t index,
    for( uint_t i = uint_t(0); i != targetProcess.size(); ++i )
       targetProcess[i].second = uint_c( targets[index][i] );
 
-   for( auto s = sender[index].begin(); s != sender[index].end(); ++s )
-      processesToRecvFrom.insert( uint_c(*s) ) ;
+   for(pid_t s : sender[index])
+      processesToRecvFrom.insert( uint_c(s) ) ;
 }
 
 template< typename PhantomData_T >
diff --git a/src/blockforest/loadbalancing/DynamicDiffusive.h b/src/blockforest/loadbalancing/DynamicDiffusive.h
index 920e3c309dc7e97eb54f1323a2cdda8ff4d34455..1c41321c3397cbc04bc401c9fc1f35c6557e5140 100644
--- a/src/blockforest/loadbalancing/DynamicDiffusive.h
+++ b/src/blockforest/loadbalancing/DynamicDiffusive.h
@@ -172,10 +172,10 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
    
    //fill processWeight with total weight per level
    //find maxBlockWeight per level
-   for( auto it = targetProcess.begin(); it != targetProcess.end(); ++it )
+   for(auto & targetProces : targetProcess)
    {
-      const uint_t level = levelwise_ ? it->first->getLevel() : uint_t(0);
-      const auto blockWeight = weight( it->first );
+      const uint_t level = levelwise_ ? targetProces.first->getLevel() : uint_t(0);
+      const auto blockWeight = weight( targetProces.first );
       WALBERLA_ASSERT_LESS( level, levels );
       WALBERLA_CHECK_GREATER_EQUAL( blockWeight, 0.0 );
       processWeight[ level ] += blockWeight;
@@ -190,8 +190,8 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
       avgProcessWeight = processWeight;
       mpi::allReduceInplace( avgProcessWeight, mpi::SUM, MPIManager::instance()->comm() );
       const double numProcesses = double_c( MPIManager::instance()->numProcesses() );
-      for( auto it = avgProcessWeight.begin(); it != avgProcessWeight.end(); ++it )
-         *it /= numProcesses;
+      for(double & it : avgProcessWeight)
+         it /= numProcesses;
       mpi::allReduceInplace( maxBlockWeight, mpi::MAX, MPIManager::instance()->comm() );
    }
    
@@ -235,8 +235,8 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
    // alpha exchange
 
    std::map< mpi::MPIRank, mpi::MPISize > alphaRanksToRecvFrom;
-   for( auto n = neighborhood.begin(); n != neighborhood.end(); ++n )
-      alphaRanksToRecvFrom[ static_cast< mpi::MPIRank >(*n) ] = mpi::BufferSizeTrait<double>::size;
+   for(uint_t n : neighborhood)
+      alphaRanksToRecvFrom[ static_cast< mpi::MPIRank >(n) ] = mpi::BufferSizeTrait<double>::size;
 
    mpi::BufferSystem alphaBufferSystem( MPIManager::instance()->comm(), 1708 ); // dynamicdiffusion = 100 121 110 097 109 105 099 100 105 102 102 117 115 105 111 110
    alphaBufferSystem.setReceiverInfo( alphaRanksToRecvFrom );
@@ -270,15 +270,15 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
    // calculate flow for every edge (process-process connection) for every level
    
    std::map< mpi::MPIRank, mpi::MPISize > ranksToRecvFrom;
-   for( auto n = neighborhood.begin(); n != neighborhood.end(); ++n )
-      ranksToRecvFrom[ static_cast< mpi::MPIRank >(*n) ] = numeric_cast< mpi::MPISize >( levelsToProcess * mpi::BufferSizeTrait<double>::size );
+   for(uint_t n : neighborhood)
+      ranksToRecvFrom[ static_cast< mpi::MPIRank >(n) ] = numeric_cast< mpi::MPISize >( levelsToProcess * mpi::BufferSizeTrait<double>::size );
 
    mpi::BufferSystem bufferSystem( MPIManager::instance()->comm(), 1709 ); // dynamicdiffusion = 100 121 110 097 109 105 099 100 105 102 102 117 115 105 111 110 + 1
    bufferSystem.setReceiverInfo( ranksToRecvFrom );
 
    std::map< uint_t, std::vector< double > > flow; //process rank -> flow on every level
-   for( auto n = neighborhood.begin(); n != neighborhood.end(); ++n )
-      flow[*n].resize( levels, 0.0 );
+   for(uint_t n : neighborhood)
+      flow[n].resize( levels, 0.0 );
    
    std::vector< double > localWeight( processWeight ); //per level
    
@@ -291,10 +291,10 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
    {
       WALBERLA_ASSERT_EQUAL( localWeight.size(), levels );
 
-      for( auto rank = ranksToRecvFrom.begin(); rank != ranksToRecvFrom.end(); ++rank )
+      for(auto & rank : ranksToRecvFrom)
          for( uint_t l = uint_t(0); l < levels; ++l )
             if( processLevel[l] )
-               bufferSystem.sendBuffer( rank->first ) << localWeight[l];
+               bufferSystem.sendBuffer( rank.first ) << localWeight[l];
       
       bufferSystem.sendAll();
       
@@ -323,26 +323,26 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
       }
    }
    
-   for( auto it = targetProcess.begin(); it != targetProcess.end(); ++it )
-      it->second = blockforest.getProcess();
+   for(auto & targetProces : targetProcess)
+      targetProces.second = blockforest.getProcess();
    
    if( mode_ == DIFFUSION_PUSH || ( mode_ == DIFFUSION_PUSHPULL && (iteration & uint_t(1)) == uint_t(0) ) )  // sending processes decide which blocks are exchanged
    {      
       // calculate accumulated outflow for every level
       
       std::vector< double > outflow( levels, 0.0 );
-      for( auto it = flow.begin(); it != flow.end(); ++it )
+      for(auto & it : flow)
          for( uint_t l = uint_t(0); l < levels; ++l )
-            outflow[l] += std::max( it->second[l], 0.0 );
+            outflow[l] += std::max( it.second[l], 0.0 );
       
       // use global information to adapt outflow
       
       if( adaptOutflowWithGlobalInformation_ )
       {
          std::vector< double > inflow( levels, 0.0 );
-         for( auto it = flow.begin(); it != flow.end(); ++it )
+         for(auto & it : flow)
             for( uint_t l = uint_t(0); l < levels; ++l )
-               inflow[l] += std::min( it->second[l], 0.0 );
+               inflow[l] += std::min( it.second[l], 0.0 );
 
          std::vector< double > flowScaleFactor( levels, 1.0 );
          for( uint_t l = uint_t(0); l < levels; ++l )
@@ -369,10 +369,10 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
             }
          }
 
-         for( auto it = flow.begin(); it != flow.end(); ++it )
+         for(auto & it : flow)
             for( uint_t l = uint_t(0); l < levels; ++l )
-               if( it->second[l] > 0.0 )
-                  it->second[l] *= flowScaleFactor[l];
+               if( it.second[l] > 0.0 )
+                  it.second[l] *= flowScaleFactor[l];
       }
       
       // determine which blocks are send to which process
@@ -474,12 +474,12 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
                   std::set< uint_t > assigned;
                   for( auto type = connectionType.begin(); type != connectionType.end(); ++type )
                   {
-                     for( auto index = type->begin(); index != type->end(); ++index )
+                     for(uint_t index : *type)
                      {
-                        if( assigned.find(*index) == assigned.end() )
+                        if( assigned.find(index) == assigned.end() )
                         {
-                           candidates.push_back(*index); // -> this order leads to a prioritization of face over edge over corner connections (if everything else is equal)
-                           assigned.insert(*index);
+                           candidates.push_back(index); // -> this order leads to a prioritization of face over edge over corner connections (if everything else is equal)
+                           assigned.insert(index);
                         }
                      }
                   }
@@ -559,11 +559,11 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
 
                // only blocks that do not exceed the entire process outflow are viable candidates
                std::vector< uint_t > viableCandidates;
-               for( auto candidate = candidates.begin(); candidate != candidates.end(); ++candidate )
+               for(uint_t & candidate : candidates)
                {
-                  if( weight( targetProcess[ *candidate ].first ) <= ( outflowExcess + outflow[l] ) ) // ( outflowExceedFactor_ * outflow[l] ) )
+                  if( weight( targetProcess[ candidate ].first ) <= ( outflowExcess + outflow[l] ) ) // ( outflowExceedFactor_ * outflow[l] ) )
                   {
-                     viableCandidates.push_back( *candidate );
+                     viableCandidates.push_back( candidate );
                   }
                }
 
@@ -607,18 +607,18 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
       // calculate accumulated inflow for every level
       
       std::vector< double > inflow( levels, 0.0 ); // inflow is saved as a positive number!
-      for( auto it = flow.begin(); it != flow.end(); ++it )
+      for(auto & it : flow)
          for( uint_t l = uint_t(0); l < levels; ++l )
-            inflow[l] -= std::min( it->second[l], 0.0 );
+            inflow[l] -= std::min( it.second[l], 0.0 );
       
       // use global information to adapt inflow
       
       if( adaptInflowWithGlobalInformation_ )
       {
          std::vector< double > outflow( levels, 0.0 );
-         for( auto it = flow.begin(); it != flow.end(); ++it )
+         for(auto & it : flow)
             for( uint_t l = uint_t(0); l < levels; ++l )
-               outflow[l] += std::max( it->second[l], 0.0 );
+               outflow[l] += std::max( it.second[l], 0.0 );
 
          std::vector< double > flowScaleFactor( levels, 1.0 );
          for( uint_t l = uint_t(0); l < levels; ++l )
@@ -636,10 +636,10 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
             }
          }
 
-         for( auto it = flow.begin(); it != flow.end(); ++it )
+         for(auto & it : flow)
             for( uint_t l = uint_t(0); l < levels; ++l )
-               if( it->second[l] < 0.0 )
-                  it->second[l] *= flowScaleFactor[l];
+               if( it.second[l] < 0.0 )
+                  it.second[l] *= flowScaleFactor[l];
       }
       
       // determine blocks with connections to neighbors processes, sort these blocks by their connection type, and
@@ -649,11 +649,11 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
       std::vector< std::vector< uint_t > > blocksConnectedToOtherProcesses; // sorted by level
       std::vector< std::vector< uint_t > > allBlocks; // sorted by level
       
-      for( auto n = neighborhood.begin(); n != neighborhood.end(); ++n )
+      for(uint_t n : neighborhood)
       {
-         blocksForNeighbors[*n].resize( levels );
+         blocksForNeighbors[n].resize( levels );
          for( uint_t l = uint_t(0); l < levels; ++l )
-            blocksForNeighbors[*n][l].resize( 8 ); // 0 = full face (same level), 1 = full face (different level), 2 = part face,
+            blocksForNeighbors[n][l].resize( 8 ); // 0 = full face (same level), 1 = full face (different level), 2 = part face,
                                                    // 3 = full edge (same level), 4 = full edge (different level), 5 = part edge,
                                                    // 6 = corner (same level), 7 = corner (different level)
       }
@@ -752,30 +752,30 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
                   std::set< uint_t > assigned;
                   for( auto type = it->second[l].begin(); type != it->second[l].end(); ++type )
                   {
-                     for( auto index = type->begin(); index != type->end(); ++index )
+                     for(uint_t index : *type)
                      {
-                        if( assigned.find(*index) == assigned.end() )
+                        if( assigned.find(index) == assigned.end() )
                         {
-                           const auto * block = targetProcess[*index].first;
+                           const auto * block = targetProcess[index].first;
                            blocksForNeighborsUnsorted[np].push_back( std::make_pair( block->getId(), weight(block) ) ); // -> this order leads to a prioritization of face over edge over corner connections
-                           assigned.insert(*index);
+                           assigned.insert(index);
                         }
                      }
                   }
-                  for( auto index = blocksConnectedToOtherProcesses[l].begin(); index != blocksConnectedToOtherProcesses[l].end(); ++index )
+                  for(uint_t & index : blocksConnectedToOtherProcesses[l])
                   {
-                     if( assigned.find(*index) == assigned.end() )
+                     if( assigned.find(index) == assigned.end() )
                      {
-                        const auto * block = targetProcess[*index].first;
+                        const auto * block = targetProcess[index].first;
                         blocksForNeighborsUnsorted[np].push_back( std::make_pair( block->getId(), weight(block) ) );
-                        assigned.insert(*index);
+                        assigned.insert(index);
                      }
                   }
-                  for( auto index = allBlocks[l].begin(); index != allBlocks[l].end(); ++index )
+                  for(unsigned long & index : allBlocks[l])
                   {
-                     if( assigned.find(*index) == assigned.end() )
+                     if( assigned.find(index) == assigned.end() )
                      {
-                        const auto * block = targetProcess[*index].first;
+                        const auto * block = targetProcess[index].first;
                         blocksForNeighborsUnsorted[np].push_back( std::make_pair( block->getId(), weight(block) ) );
                      }
                   }
@@ -783,8 +783,8 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
                else
                {
                   std::vector< uint_t > blocksToPick;
-                  for( auto index = allBlocks[l].begin(); index != allBlocks[l].end(); ++index )
-                     blocksToPick.push_back( *index );
+                  for(uint_t & index : allBlocks[l])
+                     blocksToPick.push_back( index );
                   while( ! blocksToPick.empty() )
                   {
                      const uint_t pickedBlock = random_( uint_t(0), uint_c( blocksToPick.size() ) - uint_t(1) );
@@ -807,14 +807,14 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
       }
 
       std::set< mpi::MPIRank > neighborsToRecvFrom;
-      for( auto n = neighborhood.begin(); n != neighborhood.end(); ++n )
-         neighborsToRecvFrom.insert( static_cast< mpi::MPIRank >(*n) );
+      for(uint_t n : neighborhood)
+         neighborsToRecvFrom.insert( static_cast< mpi::MPIRank >(n) );
 
       mpi::BufferSystem neighborsBufferSystem( MPIManager::instance()->comm(), 1710 ); // dynamicdiffusion = 100 121 110 097 109 105 099 100 105 102 102 117 115 105 111 110 + 2
       neighborsBufferSystem.setReceiverInfo( neighborsToRecvFrom, true );
       
-      for( auto rank = neighborsToRecvFrom.begin(); rank != neighborsToRecvFrom.end(); ++rank )
-         neighborsBufferSystem.sendBuffer( *rank ) << blocksForNeighborsUnsorted[ uint_c( *rank ) ];
+      for(mpi::MPIRank rank : neighborsToRecvFrom)
+         neighborsBufferSystem.sendBuffer( rank ) << blocksForNeighborsUnsorted[ uint_c( rank ) ];
       
       neighborsBufferSystem.sendAll();
       
@@ -877,11 +877,11 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
       
                // only blocks that do not exceed the entire process inflow are viable candidates
                std::vector< std::pair< BlockID, double > > viableCandidates;
-               for( auto candidate = candidates.begin(); candidate != candidates.end(); ++candidate )
+               for(const auto & candidate : candidates)
                {
-                  if( pickedBlocks.find( candidate->first ) == pickedBlocks.end() && candidate->second <= ( inflowExcess + inflow[l] ) )
+                  if( pickedBlocks.find( candidate.first ) == pickedBlocks.end() && candidate.second <= ( inflowExcess + inflow[l] ) )
                   {
-                     viableCandidates.push_back( *candidate );
+                     viableCandidates.push_back( candidate );
                   }
                }
 
@@ -922,8 +922,8 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
       
       // tell neighbors about blocks we want to fetch
       
-      for( auto rank = neighborsToRecvFrom.begin(); rank != neighborsToRecvFrom.end(); ++rank )
-         neighborsBufferSystem.sendBuffer( *rank ) << blocksToFetch[ uint_c( *rank ) ];
+      for(mpi::MPIRank rank : neighborsToRecvFrom)
+         neighborsBufferSystem.sendBuffer( rank ) << blocksToFetch[ uint_c( rank ) ];
       
       neighborsBufferSystem.sendAll();
       
@@ -942,8 +942,8 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
       for( auto it = blocksToSend.begin(); it != blocksToSend.end(); ++it )
       {
          const uint_t p = it->first;
-         for( auto id = it->second.begin(); id != it->second.end(); ++id )
-            processToSendTo[ *id ].push_back( p );
+         for(auto & id : it->second)
+            processToSendTo[ id ].push_back( p );
       }
       
       for( auto it = processToSendTo.begin(); it != processToSendTo.end(); ++it )
@@ -972,16 +972,16 @@ bool DynamicDiffusionBalance< PhantomData_T >::operator()( std::vector< std::pai
    // synchronize with neighbors if blocks are exchanged
 
    std::map< uint_t, uint8_t > sendBlocksToNeighbor;
-   for( auto n = neighborhood.begin(); n != neighborhood.end(); ++n )
-      sendBlocksToNeighbor[*n] = uint8_t(0);
+   for(uint_t n : neighborhood)
+      sendBlocksToNeighbor[n] = uint8_t(0);
 
-   for( auto it = targetProcess.begin(); it != targetProcess.end(); ++it )
-      if( it->second != blockforest.getProcess() )
-         sendBlocksToNeighbor[ it->second ] = uint8_t(1);
+   for(auto & targetProces : targetProcess)
+      if( targetProces.second != blockforest.getProcess() )
+         sendBlocksToNeighbor[ targetProces.second ] = uint8_t(1);
 
    std::map< mpi::MPIRank, mpi::MPISize > blocksRanksToRecvFrom;
-   for( auto n = neighborhood.begin(); n != neighborhood.end(); ++n )
-      blocksRanksToRecvFrom[ static_cast< mpi::MPIRank >(*n) ] = mpi::BufferSizeTrait<uint8_t>::size;
+   for(uint_t n : neighborhood)
+      blocksRanksToRecvFrom[ static_cast< mpi::MPIRank >(n) ] = mpi::BufferSizeTrait<uint8_t>::size;
 
    mpi::BufferSystem blocksBufferSystem( MPIManager::instance()->comm(), 1711 ); // dynamicdiffusion = 100 121 110 097 109 105 099 100 105 102 102 117 115 105 111 110 + 3
    blocksBufferSystem.setReceiverInfo( blocksRanksToRecvFrom );
diff --git a/src/blockforest/loadbalancing/DynamicParMetis.cpp b/src/blockforest/loadbalancing/DynamicParMetis.cpp
index 062ce75851ef4d9f7eb36cae9a23e0383b2ebf3e..1d7557c1d579cd8c9134b469975d0471c250ccba 100644
--- a/src/blockforest/loadbalancing/DynamicParMetis.cpp
+++ b/src/blockforest/loadbalancing/DynamicParMetis.cpp
@@ -64,17 +64,17 @@ std::map< blockforest::BlockID, uint_t > getBlockIdToSequenceMapping( const Phan
    std::map< blockforest::BlockID, uint_t > mapping;
 
    uint_t sequenceId = blockSequenceRange.first;
-   for( auto it = targetProcess.begin(); it != targetProcess.end(); ++it )
-      mapping.insert( std::make_pair( it->first->getId(), sequenceId++ ) );
+   for(const auto & targetProces : targetProcess)
+      mapping.insert( std::make_pair( targetProces.first->getId(), sequenceId++ ) );
    WALBERLA_ASSERT_EQUAL( sequenceId, blockSequenceRange.second );
 
    const std::vector<uint_t>& neighborProcesses = phantomForest.getNeighboringProcesses();
    
    mpi::BufferSystem bs( comm );
 
-   for( auto it = neighborProcesses.begin(); it != neighborProcesses.end(); ++it )
+   for(uint_t neighborProcesse : neighborProcesses)
    {
-      auto destRank = mpi::translateRank(mpi::MPIManager::instance()->comm(), comm, int_c(*it));
+      auto destRank = mpi::translateRank(mpi::MPIManager::instance()->comm(), comm, int_c(neighborProcesse));
       if (destRank != -1)
          bs.sendBuffer( destRank ) << mapping;
    }
@@ -88,9 +88,9 @@ std::map< blockforest::BlockID, uint_t > getBlockIdToSequenceMapping( const Phan
       std::map< blockforest::BlockID, uint_t > remoteMapping;
       it.buffer() >> remoteMapping;
 
-      for( auto remoteIt = remoteMapping.begin(); remoteIt != remoteMapping.end(); ++remoteIt )
+      for(auto & remoteIt : remoteMapping)
       {
-         auto result = mapping.insert( *remoteIt );
+         auto result = mapping.insert( remoteIt );
          WALBERLA_UNUSED( result );
          WALBERLA_ASSERT( result.second, "BlockId should be unique!" );
       }
@@ -164,14 +164,14 @@ bool DynamicParMetis::operator()( std::vector< std::pair< const PhantomBlock *,
          switch( edgeSource_ )
          {
          case PARMETIS_EDGES_FROM_FOREST:
-            for( auto nit = block.getNeighborhood().begin(); nit != block.getNeighborhood().end(); ++nit )
+            for(const auto & nit : block.getNeighborhood())
             {
-               auto mapIt = mapping.find( nit->getId() );
+               auto mapIt = mapping.find( nit.getId() );
                WALBERLA_ASSERT_UNEQUAL( mapIt, mapping.end(), "BlockId of neighbor is not contained in sequence mapping!" );
                WALBERLA_CHECK_GREATER_EQUAL( mapIt->second, 0 );
                WALBERLA_CHECK_LESS( mapIt->second, vtxdist.back() );
                adjncy.push_back( int64_c( mapIt->second ) );
-               auto edgeWeightIt = bi.getEdgeWeights().find( nit->getId() );
+               auto edgeWeightIt = bi.getEdgeWeights().find( nit.getId() );
                WALBERLA_CHECK_GREATER_EQUAL( edgeWeightIt->second, 0 );
                adjwgt.push_back( edgeWeightIt == bi.getEdgeWeights().end() ? int64_t( 1 ) : edgeWeightIt->second );
             }
diff --git a/src/blockforest/loadbalancing/StaticCurve.cpp b/src/blockforest/loadbalancing/StaticCurve.cpp
index e90ec3bc10ac72a04ebbfe9ce6609552c4276158..7d6ddc15ba9ffe7469c171fa602cb32891c378b5 100644
--- a/src/blockforest/loadbalancing/StaticCurve.cpp
+++ b/src/blockforest/loadbalancing/StaticCurve.cpp
@@ -46,16 +46,16 @@ uint_t StaticLevelwiseCurveBalance::operator()( SetupBlockForest & forest, const
    {
       std::vector< SetupBlock * > blocksOnLevel;
 
-      for( auto block = blocks.begin(); block != blocks.end(); ++block )
-         if( (*block)->getLevel() == level )
-            blocksOnLevel.push_back( *block );
+      for(auto & block : blocks)
+         if( block->getLevel() == level )
+            blocksOnLevel.push_back( block );
 
       const uint_t nBlocks = blocksOnLevel.size();
 
       if( nBlocks <= ( numberOfProcesses - border ) )
       {
-         for( auto block = blocksOnLevel.begin(); block != blocksOnLevel.end(); ++block )
-            (*block)->assignTargetProcess( border++ );
+         for(auto & block : blocksOnLevel)
+            block->assignTargetProcess( border++ );
 
          WALBERLA_ASSERT_LESS_EQUAL( border, numberOfProcesses );
 
@@ -107,15 +107,15 @@ uint_t StaticLevelwiseCurveBalanceWeighted::operator()( SetupBlockForest & fores
    {
       std::vector< SetupBlock * > blocksOnLevel;
 
-      for( auto block = blocks.begin(); block != blocks.end(); ++block )
-         if( (*block)->getLevel() == level )
-            blocksOnLevel.push_back( *block );
+      for(auto & block : blocks)
+         if( block->getLevel() == level )
+            blocksOnLevel.push_back( block );
 
       workload_t totalWeight( 0 );
-      for( auto block = blocksOnLevel.begin(); block != blocksOnLevel.end(); ++block )
+      for(auto & block : blocksOnLevel)
       {
-         WALBERLA_ASSERT( !( (*block)->getWorkload() < workload_t(0) ) );
-         totalWeight += (*block)->getWorkload();
+         WALBERLA_ASSERT( !( block->getWorkload() < workload_t(0) ) );
+         totalWeight += block->getWorkload();
       }
 
       uint_t c( uint_t(0) );
diff --git a/src/blockforest/loadbalancing/StaticParMetis.cpp b/src/blockforest/loadbalancing/StaticParMetis.cpp
index c712bab5971dcda1afb3588afb7cea487c3107ca..9d95ec071d73ea47ce78751b9c1bf972673c9813 100644
--- a/src/blockforest/loadbalancing/StaticParMetis.cpp
+++ b/src/blockforest/loadbalancing/StaticParMetis.cpp
@@ -108,16 +108,16 @@ uint_t StaticLevelwiseParMetis::operator()( SetupBlockForest & forest, const uin
          xadj.push_back( int64_c( adjncy.size() ) );
 
 
-         for( auto nit = block.getNeighborhood().begin(); nit != block.getNeighborhood().end(); ++nit )
+         for(auto nit : block.getNeighborhood())
          {
-            if( (*nit)->getLevel() != level )
+            if( nit->getLevel() != level )
                continue; // ignore neighbor blocks on other levels
 
-            adjncy.push_back( int64_c( (*nit)->getIndex() ) );
+            adjncy.push_back( int64_c( nit->getIndex() ) );
 
             if(weightsToUse_ == PARMETIS_EDGE_WEIGHTS || weightsToUse_ == PARMETIS_BOTH_WEIGHTS)
             {
-               blockPairs.emplace_back( blocks[i], *nit );
+               blockPairs.emplace_back( blocks[i], nit );
             }
          }
 
@@ -197,9 +197,9 @@ uint_t StaticLevelwiseParMetis::operator()( SetupBlockForest & forest, const uin
 
    //count number of used processes
    std::vector<bool> processUsed( numberOfProcesses, false );
-   for(auto blockIt = forest.begin(); blockIt != forest.end(); ++blockIt)
+   for(auto & blockIt : forest)
    {
-      processUsed[ blockIt->getTargetProcess() ] = true;
+      processUsed[ blockIt.getTargetProcess() ] = true;
    }
 
    return uint_c(std::count( processUsed.begin(), processUsed.end(), true ));
diff --git a/src/blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.cpp b/src/blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.cpp
index f301fb84480776edd84c2b6894a8d62a1e8582ab..445551c91f396b80ba5a0e574739abf5362759e5 100644
--- a/src/blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.cpp
+++ b/src/blockforest/loadbalancing/level_determination/MinMaxLevelDetermination.cpp
@@ -29,26 +29,26 @@ void MinMaxLevelDetermination::operator()( std::vector< std::pair< const Block *
                                            std::vector< const Block * > &,
                                            const BlockForest & /*forest*/ )
 {
-   for( auto it = minTargetLevels.begin(); it != minTargetLevels.end(); ++it )
+   for(auto & minTargetLevel : minTargetLevels)
    {
-      const auto infoIt = ic_->find(it->first->getId());
+      const auto infoIt = ic_->find(minTargetLevel.first->getId());
       WALBERLA_ASSERT_UNEQUAL( infoIt, ic_->end() );
 
-      it->second = it->first->getLevel(); //keep everything as it is
+      minTargetLevel.second = minTargetLevel.first->getLevel(); //keep everything as it is
 
       //check for refinement
       if (infoIt->second.computationalWeight > maxBodies_)
       {
-         it->second = it->first->getLevel() + uint_t(1);
+         minTargetLevel.second = minTargetLevel.first->getLevel() + uint_t(1);
          continue;
       }
 
       //check for coarsening
-      if ((it->first->getLevel() > 0) && (infoIt->second.computationalWeight < minBodies_))
+      if ((minTargetLevel.first->getLevel() > 0) && (infoIt->second.computationalWeight < minBodies_))
       {
-         if (getOrCreateCoarseInfo(it->first->getId())->second.computationalWeight < maxBodies_)
+         if (getOrCreateCoarseInfo(minTargetLevel.first->getId())->second.computationalWeight < maxBodies_)
          {
-            it->second = it->first->getLevel() - uint_t(1);
+            minTargetLevel.second = minTargetLevel.first->getLevel() - uint_t(1);
          }
          continue;
       }
diff --git a/src/blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h b/src/blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h
index 6e4d062a84daff6b3c054ccd6a861e75b455e451..948604a1ce718aefdf8ad9e7b06a1a4c462ca637 100644
--- a/src/blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h
+++ b/src/blockforest/loadbalancing/weight_assignment/MetisAssignmentFunctor.h
@@ -53,9 +53,9 @@ public:
                   forest.getBlockForest().isPeriodic(2)}};
       const math::AABB domain     = forest.getBlockForest().getDomain();
 
-      for( auto it = blockData.begin(); it != blockData.end(); ++it )
+      for(auto & it : blockData)
       {
-         const PhantomBlock * block = it->first;
+         const PhantomBlock * block = it.first;
          //only change of one level is supported!
          WALBERLA_ASSERT_LESS( abs(int_c(block->getLevel()) - int_c(block->getSourceLevel())), 2 );
 
@@ -66,18 +66,18 @@ public:
          blockforest::DynamicParMetisBlockInfo info( 0 );
          info.setVertexWeight( int64_c(weight) );
          info.setVertexSize( int64_c( weight ) );
-         info.setVertexCoords( it->first->getAABB().center() );
-         for( uint_t nb = uint_t(0); nb < it->first->getNeighborhoodSize(); ++nb )
+         info.setVertexCoords( it.first->getAABB().center() );
+         for( uint_t nb = uint_t(0); nb < it.first->getNeighborhoodSize(); ++nb )
          {
             const real_t dx(1.0);
-            info.setEdgeWeight( it->first->getNeighborId(nb),
+            info.setEdgeWeight( it.first->getNeighborId(nb),
                                 static_cast<blockforest::DynamicParMetisBlockInfo::weight_t>(
                                 domain_decomposition::periodicIntersectionVolume( periodic,
                                                                                   domain,
-                                                                                  it->first->getAABB(),
-                                                                                  it->first->getNeighborAABB(nb).getExtended(dx))) );
+                                                                                  it.first->getAABB(),
+                                                                                  it.first->getNeighborAABB(nb).getExtended(dx))) );
          }
-         it->second = info;
+         it.second = info;
          continue;
       }
    }
diff --git a/src/blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h b/src/blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h
index 2fdec3bed1c2cb6ae4f056873f692cc9fcb42b59..cbde2883b01eedc59d6d806390e099a47fda58da 100644
--- a/src/blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h
+++ b/src/blockforest/loadbalancing/weight_assignment/WeightAssignmentFunctor.h
@@ -45,15 +45,15 @@ public:
 
    void operator()( std::vector< std::pair< const PhantomBlock *, walberla::any > > & blockData, const PhantomBlockForest & )
    {
-      for( auto it = blockData.begin(); it != blockData.end(); ++it )
+      for(auto & it : blockData)
       {
-         const PhantomBlock * block = it->first;
+         const PhantomBlock * block = it.first;
          //only change of one level is supported!
          WALBERLA_CHECK_LESS( abs(int_c(block->getLevel()) - int_c(block->getSourceLevel())), 2 );
 
          auto infoIt = ic_->find( block->getId()/*.getFatherId()*/ );
          WALBERLA_CHECK_UNEQUAL( infoIt, ic_->end() );
-         it->second = PhantomBlockWeight( double_c(infoIt->second.computationalWeight) + baseWeight_ );
+         it.second = PhantomBlockWeight( double_c(infoIt->second.computationalWeight) + baseWeight_ );
       }
    }