diff --git a/Applications/FileIO/Gmsh/GmshReader.cpp b/Applications/FileIO/Gmsh/GmshReader.cpp
index cbbf36bd239de042f2f3ef427fadc5de493a5ae2..5cfa730edf8d6f5f32cbc5b1fcbed4520d259464 100644
--- a/Applications/FileIO/Gmsh/GmshReader.cpp
+++ b/Applications/FileIO/Gmsh/GmshReader.cpp
@@ -78,7 +78,6 @@ std::pair<MeshLib::Element*, int> readElement(
     unsigned idx, type, n_tags, dummy;
     int mat_id;
     std::vector<unsigned> node_ids;
-    std::vector<MeshLib::Node*> elem_nodes;
     in >> idx >> type >> n_tags >> mat_id >> dummy;
 
     // skip tags
diff --git a/Applications/FileIO/GocadIO/GocadSGridReader.cpp b/Applications/FileIO/GocadIO/GocadSGridReader.cpp
index 5f8b7dd1384785c82bc07948d60fa63c2fef3300..91e70bad385b7563556bd16b6554e6181b9ddf8b 100644
--- a/Applications/FileIO/GocadIO/GocadSGridReader.cpp
+++ b/Applications/FileIO/GocadIO/GocadSGridReader.cpp
@@ -820,10 +820,8 @@ void GocadSGridReader::addFaceSetQuad(
         default:
             ERR("Could not create face for node with id %d.", id);
     }
-    for (auto quad_node : quad_nodes)
-    {
-        face_set_nodes.push_back(quad_node);
-    }
+    std::copy(begin(quad_nodes), end(quad_nodes),
+              back_inserter(face_set_nodes));
     face_set_elements.push_back(new MeshLib::Quad(quad_nodes));
 }
 
diff --git a/Applications/FileIO/SWMM/SWMMInterface.cpp b/Applications/FileIO/SWMM/SWMMInterface.cpp
index 982134cc35ece05d0cb97591505b3bc3e6501dde..3ffd27a0f7655a586f6638abab1a160875b81b64 100644
--- a/Applications/FileIO/SWMM/SWMMInterface.cpp
+++ b/Applications/FileIO/SWMM/SWMMInterface.cpp
@@ -147,14 +147,13 @@ bool SwmmInterface::isSwmmInputFile(std::string const& inp_file_name)
 
     std::string line;
     bool header_found (false);
-    std::size_t pos_beg;
     std::size_t pos_end(0);
     while (!header_found)
     {
         if (!std::getline(in, line))
             return false;
 
-        pos_beg = line.find_first_not_of(' ', pos_end);
+        std::size_t const pos_beg = line.find_first_not_of(' ', pos_end);
         pos_end = line.find_first_of(" \n", pos_beg);
 
         // skip empty or comment lines at the beginning of the file
@@ -416,11 +415,13 @@ bool SwmmInterface::convertSwmmInputToGeometry(std::string const& inp_file_name,
     }
 
     auto name_id_map = std::make_unique<std::map<std::string, std::size_t>>();
-    std::size_t const n_names (pnt_names.size());
-    for (std::size_t i=0; i<n_names; ++i)
     {
-        if (!pnt_names[i].empty())
-            name_id_map->insert(std::make_pair(pnt_names[i], i));
+        std::size_t const n_names(pnt_names.size());
+        for (std::size_t i = 0; i < n_names; ++i)
+        {
+            if (!pnt_names[i].empty())
+                name_id_map->insert(std::make_pair(pnt_names[i], i));
+        }
     }
 
     // rewind stream and read links between junctions
@@ -468,9 +469,13 @@ bool SwmmInterface::convertSwmmInputToGeometry(std::string const& inp_file_name,
         }
         auto line_id_map =
             std::make_unique<std::map<std::string, std::size_t>>();
-        std::size_t const n_names (line_names.size());
-        for (std::size_t i=0; i<n_names; ++i)
-            line_id_map->insert(std::make_pair(line_names[i], i));
+        {
+            std::size_t const n_names(line_names.size());
+            for (std::size_t i = 0; i < n_names; ++i)
+            {
+                line_id_map->insert(std::make_pair(line_names[i], i));
+            }
+        }
         std::vector<std::size_t> const& pnt_id_map (geo_objects.getPointVecObj(geo_name)->getIDMap());
         for (GeoLib::Polyline* line : *lines)
         {
@@ -612,7 +617,6 @@ bool SwmmInterface::readSubcatchments(std::ifstream &in, std::map< std::string,
             return false;
         }
 
-        sc.outlet =  std::numeric_limits<std::size_t>::max();
         auto const it = name_id_map.find(split_str[2]);
         if (it == name_id_map.end())
         {
diff --git a/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp b/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp
index 9d8c834950c48d79a212fb7efaec6eccd4d9019d..983d19dbc7aae338172b59853cefc3a91850ab5e 100644
--- a/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp
+++ b/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp
@@ -155,11 +155,11 @@ int main (int argc, char* argv[])
     std::string fname (shapefile_arg.getValue());
 
     int shape_type, number_of_elements;
-    double padfMinBound[4], padfMaxBound[4];
 
     SHPHandle hSHP = SHPOpen(fname.c_str(),"rb");
     if (hSHP) {
-        SHPGetInfo( hSHP, &number_of_elements, &shape_type, padfMinBound, padfMaxBound );
+        SHPGetInfo(hSHP, &number_of_elements, &shape_type,
+                   nullptr /*padfMinBound*/, nullptr /*padfMinBound*/);
 
         if ((shape_type - 1) % 10 == 0)
             INFO("Shape file contains %d points.", number_of_elements);
diff --git a/Applications/Utils/FileConverter/MeshToRaster.cpp b/Applications/Utils/FileConverter/MeshToRaster.cpp
index 4b355b17b3a97c1bfbecab15d46ce6585768e190..355f5ddd1c2cd8cc548311388e7ae788f448a827 100644
--- a/Applications/Utils/FileConverter/MeshToRaster.cpp
+++ b/Applications/Utils/FileConverter/MeshToRaster.cpp
@@ -94,13 +94,13 @@ int main(int argc, char* argv[])
     MeshLib::MeshElementGrid const grid(*mesh);
     double const max_edge(mesh->getMaxEdgeLength() + cellsize);
 
-    for (std::size_t j = 0; j <= n_rows; ++j)
+    for (std::size_t row = 0; row <= n_rows; ++row)
     {
-        double const y = max[1] - j * cellsize;
-        for (std::size_t i = 0; i <= n_cols; ++i)
+        double const y = max[1] - row * cellsize;
+        for (std::size_t column = 0; column <= n_cols; ++column)
         {
             // pixel values
-            double const x = min[0] + i * cellsize;
+            double const x = min[0] + column * cellsize;
             MeshLib::Node const node(x, y, 0);
             MathLib::Point3d min_vol{{x - max_edge, y - max_edge,
                                       -std::numeric_limits<double>::max()}};
@@ -127,12 +127,15 @@ int main(int argc, char* argv[])
                 // element
                 for (std::size_t i = 0; i < 4; ++i)
                 {
-                    MeshLib::Node const node(x + x_off[i], y + y_off[i], 0);
+                    MeshLib::Node const corner_node(x + x_off[i], y + y_off[i],
+                                                    0);
                     auto const* corner_element =
-                        MeshLib::ProjectPointOnMesh::getProjectedElement(elems, node);
+                        MeshLib::ProjectPointOnMesh::getProjectedElement(
+                            elems, corner_node);
                     if (corner_element != nullptr)
                     {
-                        sum += MeshLib::ProjectPointOnMesh::getElevation( *corner_element, node);
+                        sum += MeshLib::ProjectPointOnMesh::getElevation(
+                            *corner_element, corner_node);
                         nonzero_count++;
                     }
                 }
diff --git a/Applications/Utils/MeshEdit/CreateBoundaryConditionsAlongPolylines.cpp b/Applications/Utils/MeshEdit/CreateBoundaryConditionsAlongPolylines.cpp
index 0d465e9cf1709ff85c4c5a30412b818bd34ed310..30cfb059bc62b5e691ca704d89e8cdc8c571b5a5 100644
--- a/Applications/Utils/MeshEdit/CreateBoundaryConditionsAlongPolylines.cpp
+++ b/Applications/Utils/MeshEdit/CreateBoundaryConditionsAlongPolylines.cpp
@@ -231,9 +231,9 @@ int main (int argc, char* argv[])
         {
             continue;
         }
-        std::string geo_name("Polyline-"+std::to_string(k));
-        convertMeshNodesToGeometry(surface_mesh->getNodes(), ids, geo_name,
-            geometry_sets);
+        std::string polyline_name("Polyline-" + std::to_string(k));
+        convertMeshNodesToGeometry(surface_mesh->getNodes(), ids, polyline_name,
+                                   geometry_sets);
     }
 
     // merge all together
@@ -271,11 +271,12 @@ int main (int argc, char* argv[])
     // insert first point
     surface_pnts->push_back(
         new GeoLib::Point(pnts_with_id[0], surface_pnts->size()));
-    std::string element_name;
-    pnt_vec->getNameOfElementByID(0, element_name);
-    name_id_map->insert(
-        std::pair<std::string, std::size_t>(element_name,0)
-    );
+    {
+        std::string element_name;
+        pnt_vec->getNameOfElementByID(0, element_name);
+        name_id_map->insert(
+            std::pair<std::string, std::size_t>(element_name, 0));
+    }
     for (std::size_t k(1); k < n_merged_pnts; ++k) {
         const GeoLib::Point& p0 (pnts_with_id[k-1]);
         const GeoLib::Point& p1 (pnts_with_id[k]);
diff --git a/Applications/Utils/MeshEdit/NodeReordering.cpp b/Applications/Utils/MeshEdit/NodeReordering.cpp
index 5ca4dde04774f1c1e7e7b072ef695eb86624c34d..b983c489245e5a0fe1800b75c532366e5272a60f 100644
--- a/Applications/Utils/MeshEdit/NodeReordering.cpp
+++ b/Applications/Utils/MeshEdit/NodeReordering.cpp
@@ -93,10 +93,10 @@ void reorderNodes2(std::vector<MeshLib::Element*> &elements)
         {
             if (elements[i]->getGeomType() == MeshLib::MeshElemType::PRISM)
             {
-                for(std::size_t j = 0; j < 3; ++j)
+                for (std::size_t k = 0; k < 3; ++k)
                 {
-                    elements[i]->setNode(j, nodes[j+3]);
-                    elements[i]->setNode(j+3, nodes[j]);
+                    elements[i]->setNode(k, nodes[k + 3]);
+                    elements[i]->setNode(k + 3, nodes[k]);
                 }
                 break;
             }
diff --git a/Applications/Utils/MeshEdit/UnityPreprocessing.cpp b/Applications/Utils/MeshEdit/UnityPreprocessing.cpp
index bfc284d22ead6b08fe180ee5e6b4df8dbe91cac6..2214d57736ffeadf0ff521ed13cb901c8dcfaf6b 100644
--- a/Applications/Utils/MeshEdit/UnityPreprocessing.cpp
+++ b/Applications/Utils/MeshEdit/UnityPreprocessing.cpp
@@ -84,8 +84,8 @@ bool fillPropVec(MeshLib::Properties const& props,
         std::size_t const n_nodes (node_map.size());
         for (std::size_t i = 0; i<n_nodes; ++i)
         {
-            std::size_t const n_nodes = node_map[i].size();
-            for (std::size_t j = 0; j < n_nodes; ++j)
+            std::size_t const n_nodes_i = node_map[i].size();
+            for (std::size_t j = 0; j < n_nodes_i; ++j)
             {
                 (*new_vec)[node_map[i][j]] = (*vec)[i];
             }
diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp
index 2c9493012d32337094252e4f37496d4b6acfb2a3..ae018e617a0e894ac907c2e301cd6d43521344ed 100644
--- a/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp
+++ b/Applications/Utils/ModelPreparation/PartitionMesh/NodeWiseMeshPartitioner.cpp
@@ -611,50 +611,47 @@ std::vector<Partition> NodeWiseMeshPartitioner::partitionOtherMesh(
     {
         auto& partition = partitions[part_id];
         INFO("Processing partition: %d", part_id);
-        {
-            // Set the node numbers of base and all mesh nodes.
-            partition.number_of_mesh_base_nodes = mesh.getNumberOfBaseNodes();
-            partition.number_of_mesh_all_nodes = mesh.getNumberOfNodes();
-
-            std::vector<MeshLib::Node*> higher_order_regular_nodes;
-            std::tie(partition.nodes, higher_order_regular_nodes) =
-                findNonGhostNodesInPartition(
-                    part_id, is_mixed_high_order_linear_elems,
-                    mesh.getNumberOfBaseNodes(), mesh.getNodes(),
-                    _nodes_partition_ids, bulk_node_ids);
-
-            partition.number_of_non_ghost_base_nodes = partition.nodes.size();
-            partition.number_of_non_ghost_nodes =
-                partition.number_of_non_ghost_base_nodes +
-                higher_order_regular_nodes.size();
-
-            std::tie(partition.regular_elements, partition.ghost_elements) =
-                findElementsInPartition(part_id, mesh.getElements(),
-                                        _nodes_partition_ids, bulk_node_ids);
-
-            std::vector<MeshLib::Node*> base_ghost_nodes;
-            std::vector<MeshLib::Node*> higher_order_ghost_nodes;
-            std::tie(base_ghost_nodes, higher_order_ghost_nodes) =
-                findGhostNodesInPartition(
-                    part_id, is_mixed_high_order_linear_elems,
-                    mesh.getNumberOfBaseNodes(), mesh.getNodes(),
-                    partition.ghost_elements, _nodes_partition_ids,
-                    bulk_node_ids);
-
-            std::copy(begin(base_ghost_nodes), end(base_ghost_nodes),
-                      std::back_inserter(partition.nodes));
+        // Set the node numbers of base and all mesh nodes.
+        partition.number_of_mesh_base_nodes = mesh.getNumberOfBaseNodes();
+        partition.number_of_mesh_all_nodes = mesh.getNumberOfNodes();
+
+        std::vector<MeshLib::Node*> higher_order_regular_nodes;
+        std::tie(partition.nodes, higher_order_regular_nodes) =
+            findNonGhostNodesInPartition(
+                part_id, is_mixed_high_order_linear_elems,
+                mesh.getNumberOfBaseNodes(), mesh.getNodes(),
+                _nodes_partition_ids, bulk_node_ids);
+
+        partition.number_of_non_ghost_base_nodes = partition.nodes.size();
+        partition.number_of_non_ghost_nodes =
+            partition.number_of_non_ghost_base_nodes +
+            higher_order_regular_nodes.size();
+
+        std::tie(partition.regular_elements, partition.ghost_elements) =
+            findElementsInPartition(part_id, mesh.getElements(),
+                                    _nodes_partition_ids, bulk_node_ids);
+
+        std::vector<MeshLib::Node*> base_ghost_nodes;
+        std::vector<MeshLib::Node*> higher_order_ghost_nodes;
+        std::tie(base_ghost_nodes, higher_order_ghost_nodes) =
+            findGhostNodesInPartition(part_id, is_mixed_high_order_linear_elems,
+                                      mesh.getNumberOfBaseNodes(),
+                                      mesh.getNodes(), partition.ghost_elements,
+                                      _nodes_partition_ids, bulk_node_ids);
+
+        std::copy(begin(base_ghost_nodes), end(base_ghost_nodes),
+                  std::back_inserter(partition.nodes));
 
-            partition.number_of_base_nodes = partition.nodes.size();
+        partition.number_of_base_nodes = partition.nodes.size();
 
-            if (is_mixed_high_order_linear_elems)
-            {
-                std::copy(begin(higher_order_regular_nodes),
-                          end(higher_order_regular_nodes),
-                          std::back_inserter(partition.nodes));
-                std::copy(begin(higher_order_ghost_nodes),
-                          end(higher_order_ghost_nodes),
-                          std::back_inserter(partition.nodes));
-            }
+        if (is_mixed_high_order_linear_elems)
+        {
+            std::copy(begin(higher_order_regular_nodes),
+                      end(higher_order_regular_nodes),
+                      std::back_inserter(partition.nodes));
+            std::copy(begin(higher_order_ghost_nodes),
+                      end(higher_order_ghost_nodes),
+                      std::back_inserter(partition.nodes));
         }
     }
 
diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/PartitionMesh.cpp b/Applications/Utils/ModelPreparation/PartitionMesh/PartitionMesh.cpp
index fbdfd3fcf11a30e3b8869422fc923638265bac26..562a297c4adfc207cb11de54f77cffcb49ccff0e 100644
--- a/Applications/Utils/ModelPreparation/PartitionMesh/PartitionMesh.cpp
+++ b/Applications/Utils/ModelPreparation/PartitionMesh/PartitionMesh.cpp
@@ -179,9 +179,10 @@ int main(int argc, char* argv[])
              mesh->getNumberOfNodes(),
              mesh->getNumberOfElements());
 
-        std::string const output_file_name_wo_extension = BaseLib::joinPaths(
-            output_directory_arg.getValue(),
-            BaseLib::extractBaseNameWithoutExtension(filename));
+        std::string const other_mesh_output_file_name_wo_extension =
+            BaseLib::joinPaths(
+                output_directory_arg.getValue(),
+                BaseLib::extractBaseNameWithoutExtension(filename));
         auto const partitions = mesh_partitioner.partitionOtherMesh(
             *mesh, is_mixed_high_order_linear_elems);
 
@@ -195,8 +196,9 @@ int main(int argc, char* argv[])
             partitioned_properties.getPropertyVector<std::size_t>(
                 "bulk_element_ids", MeshLib::MeshItemType::Cell, 1),
             partitions);
-        mesh_partitioner.writeOtherMesh(output_file_name_wo_extension,
-                                        partitions, partitioned_properties);
+        mesh_partitioner.writeOtherMesh(
+            other_mesh_output_file_name_wo_extension, partitions,
+            partitioned_properties);
     }
 
     if (ascii_flag.getValue())
diff --git a/GeoLib/GEOObjects.cpp b/GeoLib/GEOObjects.cpp
index 23809f0e63bf0d2cd46934a53ae87742c571daf3..9902bb96533c2e47ddce878bef611223754cec01 100644
--- a/GeoLib/GEOObjects.cpp
+++ b/GeoLib/GEOObjects.cpp
@@ -120,13 +120,14 @@ void GEOObjects::addStationVec(std::unique_ptr<std::vector<Point*>> stations,
 const std::vector<GeoLib::Point*>* GEOObjects::getStationVec(
     const std::string& name) const
 {
-    for (auto point : _pnt_vecs)
+    auto const it = std::find_if(
+        begin(_pnt_vecs), end(_pnt_vecs), [&name](PointVec const* const p) {
+            return p->getName() == name &&
+                   p->getType() == PointVec::PointType::STATION;
+        });
+    if (it != end(_pnt_vecs))
     {
-        if (point->getName() == name &&
-            point->getType() == PointVec::PointType::STATION)
-        {
-            return point->getVector();
-        }
+        return (*it)->getVector();
     }
     DBUG("GEOObjects::getStationVec() - No entry found with name '%s'.",
          name.c_str());
@@ -283,11 +284,8 @@ bool GEOObjects::appendSurfaceVec(const std::vector<Surface*>& surfaces,
 
     // the copy is needed because addSurfaceVec is passing it to SurfaceVec
     // ctor, which needs write access to the surface vector.
-    auto sfc = std::make_unique<std::vector<GeoLib::Surface*>>();
-    for (auto surface : surfaces)
-    {
-        sfc->push_back(surface);
-    }
+    auto sfc = std::make_unique<std::vector<GeoLib::Surface*>>(begin(surfaces),
+                                                               end(surfaces));
     addSurfaceVec(std::move(sfc), name);
     return false;
 }
diff --git a/MathLib/LinAlg/Lis/LisLinearSolver.cpp b/MathLib/LinAlg/Lis/LisLinearSolver.cpp
index 95cde280cfe43faa089a949cbebe4f2b8789eb97..9829c95bd61a33896b97c791518f468af27f4168 100644
--- a/MathLib/LinAlg/Lis/LisLinearSolver.cpp
+++ b/MathLib/LinAlg/Lis/LisLinearSolver.cpp
@@ -55,11 +55,15 @@ bool LisLinearSolver::solve(LisMatrix &A, LisVector &b, LisVector &x)
     {
         int precon;
         ierr = lis_solver_get_precon(solver, &precon);
+        if (!checkLisError(ierr))
+            return false;
         INFO("-> precon: %i", precon);
     }
     {
         int slv;
         ierr = lis_solver_get_solver(solver, &slv);
+        if (!checkLisError(ierr))
+            return false;
         INFO("-> solver: %i", slv);
     }
 
diff --git a/MathLib/LinAlg/Lis/LisMatrix.cpp b/MathLib/LinAlg/Lis/LisMatrix.cpp
index 5b075ebc256951fa60b9ee42dfd7921ee89f0774..6cccbfae9f8cb1205865b819dc4faf89d73167c2 100644
--- a/MathLib/LinAlg/Lis/LisMatrix.cpp
+++ b/MathLib/LinAlg/Lis/LisMatrix.cpp
@@ -63,7 +63,10 @@ LisMatrix::~LisMatrix()
 {
     int ierr = 0;
     if (_use_external_arrays)
+    {
         ierr = lis_matrix_unset(_AA);
+        checkLisError(ierr);
+    }
     ierr = lis_matrix_destroy(_AA);
     checkLisError(ierr);
     ierr = lis_vector_destroy(_diag);
diff --git a/MeshGeoToolsLib/GeoMapper.cpp b/MeshGeoToolsLib/GeoMapper.cpp
index 21ebfc6da48969869f5bbd8185d227ff5bd39287..f8bd85cdfefc6ffde6ce95db2faf7b3ab961ffe0 100644
--- a/MeshGeoToolsLib/GeoMapper.cpp
+++ b/MeshGeoToolsLib/GeoMapper.cpp
@@ -285,10 +285,8 @@ static std::vector<MathLib::Point3d> computeElementSegmentIntersections(
             true};
         std::vector<MathLib::Point3d> const intersections(
             GeoLib::lineSegmentIntersect2d(segment, elem_segment));
-        for (auto const& p : intersections)
-        {
-            element_intersections.push_back(std::move(p));
-        }
+        element_intersections.insert(end(element_intersections),
+                                     begin(intersections), end(intersections));
     }
     return element_intersections;
 }
diff --git a/MeshLib/ElementStatus.cpp b/MeshLib/ElementStatus.cpp
index 29bdff5e67e7b4c40ed63d2ac465add2a413a3b7..effdd6a0eedb883a9ab59ea164895bb3a81fd817 100644
--- a/MeshLib/ElementStatus.cpp
+++ b/MeshLib/ElementStatus.cpp
@@ -26,10 +26,9 @@ ElementStatus::ElementStatus(Mesh const* const mesh, bool hasAnyInactive)
       _hasAnyInactive(hasAnyInactive)
 {
     const std::vector<MeshLib::Node*>& nodes(_mesh->getNodes());
-    for (auto node : nodes)
-    {
-        _active_nodes.push_back(node->getNumberOfElements());
-    }
+    std::transform(
+        begin(nodes), end(nodes), back_inserter(_active_nodes),
+        [](Node const* const n) { return n->getNumberOfElements(); });
 }
 
 ElementStatus::ElementStatus(Mesh const* const mesh,
diff --git a/MeshLib/MeshGenerators/VtkMeshConverter.cpp b/MeshLib/MeshGenerators/VtkMeshConverter.cpp
index 7def6a68af62f01a7f2a1ed3736da10c6ab978c7..ad773365b1e417956c15a4ff3b0512329f30f344 100644
--- a/MeshLib/MeshGenerators/VtkMeshConverter.cpp
+++ b/MeshLib/MeshGenerators/VtkMeshConverter.cpp
@@ -154,10 +154,10 @@ MeshLib::Mesh* VtkMeshConverter::convertUnstructuredGrid(
             case VTK_WEDGE:
             {
                 auto** prism_nodes = new MeshLib::Node*[6];
-                for (unsigned i = 0; i < 3; ++i)
+                for (unsigned j = 0; j < 3; ++j)
                 {
-                    prism_nodes[i] = nodes[node_ids->GetId(i + 3)];
-                    prism_nodes[i + 3] = nodes[node_ids->GetId(i)];
+                    prism_nodes[j] = nodes[node_ids->GetId(j + 3)];
+                    prism_nodes[j + 3] = nodes[node_ids->GetId(j)];
                 }
                 elem = new MeshLib::Prism(prism_nodes, i);
                 break;
@@ -208,21 +208,21 @@ MeshLib::Mesh* VtkMeshConverter::convertUnstructuredGrid(
             case VTK_QUADRATIC_WEDGE:
             {
                 auto** prism_nodes = new MeshLib::Node*[15];
-                for (unsigned i = 0; i < 3; ++i)
+                for (unsigned j = 0; j < 3; ++j)
                 {
-                    prism_nodes[i] = nodes[node_ids->GetId(i + 3)];
-                    prism_nodes[i + 3] = nodes[node_ids->GetId(i)];
+                    prism_nodes[j] = nodes[node_ids->GetId(j + 3)];
+                    prism_nodes[j + 3] = nodes[node_ids->GetId(j)];
                 }
-                for (unsigned i = 0; i < 3; ++i)
+                for (unsigned j = 0; j < 3; ++j)
                 {
-                    prism_nodes[6 + i] = nodes[node_ids->GetId(8 - i)];
+                    prism_nodes[6 + j] = nodes[node_ids->GetId(8 - j)];
                 }
                 prism_nodes[9] = nodes[node_ids->GetId(12)];
                 prism_nodes[10] = nodes[node_ids->GetId(14)];
                 prism_nodes[11] = nodes[node_ids->GetId(13)];
-                for (unsigned i = 0; i < 3; ++i)
+                for (unsigned j = 0; j < 3; ++j)
                 {
-                    prism_nodes[12 + i] = nodes[node_ids->GetId(11 - i)];
+                    prism_nodes[12 + j] = nodes[node_ids->GetId(11 - j)];
                 }
                 elem = new MeshLib::Prism15(prism_nodes, i);
                 break;
diff --git a/MeshLib/MeshSearch/ElementSearch.cpp b/MeshLib/MeshSearch/ElementSearch.cpp
index 2fb71a0697452e8a76ab5f6d7d315dd07b20f357..94627e1be43c47e99edcd31e61d3f6d871e14faf 100644
--- a/MeshLib/MeshSearch/ElementSearch.cpp
+++ b/MeshLib/MeshSearch/ElementSearch.cpp
@@ -80,9 +80,10 @@ std::size_t ElementSearch::searchByNodeIDs(const std::vector<std::size_t> &nodes
     std::vector<std::size_t> connected_elements;
     for (std::size_t node_id : nodes)
     {
-        for (auto* e : _mesh.getNode(node_id)->getElements()) {
-            connected_elements.push_back(e->getID());
-        }
+        auto const& elements = _mesh.getNode(node_id)->getElements();
+        std::transform(begin(elements), end(elements),
+                       back_inserter(connected_elements),
+                       [](Element const* const e) { return e->getID(); });
     }
 
     BaseLib::makeVectorUnique(connected_elements);
diff --git a/NumLib/Fem/ShapeFunction/ShapeHex20-impl.h b/NumLib/Fem/ShapeFunction/ShapeHex20-impl.h
index 51be47245250dc52d07cd47ba7333504abb5c14f..bd6582827a05f6726acd3404416bc4d6acb80c5d 100644
--- a/NumLib/Fem/ShapeFunction/ShapeHex20-impl.h
+++ b/NumLib/Fem/ShapeFunction/ShapeHex20-impl.h
@@ -88,7 +88,6 @@ void ShapeHex20::computeShapeFunction(const T_X &rst, T_N &N)
 template <class T_X, class T_N>
 void ShapeHex20::computeGradShapeFunction(const T_X &rst, T_N &dNdr)
 {
-    int co;
     const double r = rst[0];
     const double s = rst[1];
     const double t = rst[2];
@@ -111,17 +110,27 @@ void ShapeHex20::computeGradShapeFunction(const T_X &rst, T_N &dNdr)
         dNdr[20 * i + 14] = sign2[i] * sign3[i] * dShapeFunctionHexHQ_Middle(r,-s,-t,i);
         dNdr[20 * i + 12] = sign3[i] * dShapeFunctionHexHQ_Middle(r,s,-t,i);
 
-        co = (i + 2) % 3;
-        dNdr[20 * i + 11] = dShapeFunctionHexHQ_Middle(s,t,r,co);
-        dNdr[20 * i + 15] = sign3[i] * dShapeFunctionHexHQ_Middle(s,-t,r,co);
-        dNdr[20 * i + 13] = sign1[i] * sign3[i] * dShapeFunctionHexHQ_Middle(s,-t,-r,co);
-        dNdr[20 * i + 9] =  sign1[i] * dShapeFunctionHexHQ_Middle(s,t,-r,co);
-
-        co = (i + 1) % 3;
-        dNdr[20 * i + 16] = dShapeFunctionHexHQ_Middle(t,r,s,co);
-        dNdr[20 * i + 17] = sign1[i] * dShapeFunctionHexHQ_Middle(t,-r,s,co);
-        dNdr[20 * i + 18] = sign1[i] * sign2[i] * dShapeFunctionHexHQ_Middle(t,-r,-s,co);
-        dNdr[20 * i + 19] = sign2[i] * dShapeFunctionHexHQ_Middle(t,r,-s,co);
+        {
+            int const co = (i + 2) % 3;
+            dNdr[20 * i + 11] = dShapeFunctionHexHQ_Middle(s, t, r, co);
+            dNdr[20 * i + 15] =
+                sign3[i] * dShapeFunctionHexHQ_Middle(s, -t, r, co);
+            dNdr[20 * i + 13] =
+                sign1[i] * sign3[i] * dShapeFunctionHexHQ_Middle(s, -t, -r, co);
+            dNdr[20 * i + 9] =
+                sign1[i] * dShapeFunctionHexHQ_Middle(s, t, -r, co);
+        }
+
+        {
+            int const co = (i + 1) % 3;
+            dNdr[20 * i + 16] = dShapeFunctionHexHQ_Middle(t, r, s, co);
+            dNdr[20 * i + 17] =
+                sign1[i] * dShapeFunctionHexHQ_Middle(t, -r, s, co);
+            dNdr[20 * i + 18] =
+                sign1[i] * sign2[i] * dShapeFunctionHexHQ_Middle(t, -r, -s, co);
+            dNdr[20 * i + 19] =
+                sign2[i] * dShapeFunctionHexHQ_Middle(t, r, -s, co);
+        }
     }
 }
 
diff --git a/ProcessLib/ComponentTransport/ComponentTransportFEM.h b/ProcessLib/ComponentTransport/ComponentTransportFEM.h
index 26320aaa0aaf4862cdf19e19ada7dec3ffc864ea..58b4ad4354628acce1da941cccac5823d33ed459 100644
--- a/ProcessLib/ComponentTransport/ComponentTransportFEM.h
+++ b/ProcessLib/ComponentTransport/ComponentTransportFEM.h
@@ -346,7 +346,6 @@ public:
             auto const N_t_N = (N.transpose() * N).eval();
             if (_process_data.non_advective_form)
             {
-                const double C_int_pt(N.dot(C_nodal_values));
                 MCp.noalias() += N_t_N * (C_int_pt * R_times_phi * drho_dp * w);
                 MCC.noalias() += N_t_N * (C_int_pt * R_times_phi * drho_dC * w);
                 KCC.noalias() -= dNdx.transpose() * mass_density_flow * N * w;
@@ -812,15 +811,15 @@ public:
             auto const fe = NumLib::createIsoparametricFiniteElement<
                 ShapeFunction, ShapeMatricesType>(_element);
 
-            typename ShapeMatricesType::ShapeMatrices shape_matrices(
+            typename ShapeMatricesType::ShapeMatrices sm(
                 ShapeFunction::DIM, GlobalDim, ShapeFunction::NPOINTS);
 
             // Note: Axial symmetry is set to false here, because we only need
             // dNdx here, which is not affected by axial symmetry.
             fe.template computeShapeFunctions<NumLib::ShapeMatrixType::DNDX>(
-                pnt_local_coords.getCoords(), shape_matrices, GlobalDim, false);
+                pnt_local_coords.getCoords(), sm, GlobalDim, false);
 
-            return shape_matrices;
+            return sm;
         }();
 
         ParameterLib::SpatialPosition pos;
diff --git a/ProcessLib/DeactivatedSubdomain.cpp b/ProcessLib/DeactivatedSubdomain.cpp
index 26487b9ef304f39499d3eea6c16b5897f8f4f43f..132e10a36f25658fe5b417ccc5b1e176aba867aa 100644
--- a/ProcessLib/DeactivatedSubdomain.cpp
+++ b/ProcessLib/DeactivatedSubdomain.cpp
@@ -107,9 +107,9 @@ std::unique_ptr<DeactivatedSubdomain const> createDeactivatedSubdomain(
             deactivated_elements.push_back(
                 const_cast<MeshLib::Element*>(element));
 
-            for (unsigned i = 0; i < element->getNumberOfNodes(); i++)
+            for (unsigned j = 0; j < element->getNumberOfNodes(); j++)
             {
-                auto const* const node = element->getNode(i);
+                auto const* const node = element->getNode(j);
                 const auto& connected_elements = node->getElements();
 
                 if (deactivation_flag_of_nodes[node->getID()])
diff --git a/ProcessLib/LIE/Common/MeshUtils.cpp b/ProcessLib/LIE/Common/MeshUtils.cpp
index 73b391801af4046139666f0b634e8eb86afe5c3b..0f8af04aeba97c7b858d6fd5607787fb88c895f9 100644
--- a/ProcessLib/LIE/Common/MeshUtils.cpp
+++ b/ProcessLib/LIE/Common/MeshUtils.cpp
@@ -108,11 +108,11 @@ void findFracutreIntersections(
 
     // find branch/junction nodes which connect to multiple fractures
     intersected_fracture_elements.resize(n_fractures);
-    for (auto entry : frac_nodeID_to_matIDs)
+    for (auto frac_nodeID_to_matID : frac_nodeID_to_matIDs)
     {
-        auto nodeID = entry.first;
-        auto const* node = mesh.getNode(entry.first);
-        auto const& matIDs = entry.second;
+        auto nodeID = frac_nodeID_to_matID.first;
+        auto const* node = mesh.getNode(frac_nodeID_to_matID.first);
+        auto const& matIDs = frac_nodeID_to_matID.second;
         if (matIDs.size() < 2)
         {
             continue;  // no intersection
@@ -159,9 +159,9 @@ void findFracutreIntersections(
 
         bool isBranch = false;
         {
-            for (auto entry : vec_matID_counts)
+            for (auto vec_matID_count : vec_matID_counts)
             {
-                auto count = entry.second;
+                auto count = vec_matID_count.second;
                 if (count % 2 == 1)
                 {
                     isBranch = true;
@@ -172,30 +172,30 @@ void findFracutreIntersections(
 
         if (isBranch)
         {
-            std::vector<int> matIDs(2);
-            for (auto entry : vec_matID_counts)
+            std::vector<int> branch_matIDs(2);
+            for (auto vec_matID_count : vec_matID_counts)
             {
-                auto matid = entry.first;
-                auto count = entry.second;
+                auto matid = vec_matID_count.first;
+                auto count = vec_matID_count.second;
                 if (count % 2 == 0)
                 {
-                    matIDs[0] = matid;  // master
+                    branch_matIDs[0] = matid;  // master
                 }
                 else
                 {
-                    matIDs[1] = matid;  // slave
+                    branch_matIDs[1] = matid;  // slave
                 }
             }
-            vec_branch_nodeID_matIDs.emplace_back(nodeID, matIDs);
+            vec_branch_nodeID_matIDs.emplace_back(nodeID, branch_matIDs);
         }
         else
         {
-            std::vector<int> matIDs(2);
-            matIDs[0] = std::min(vec_matID_counts.begin()->first,
-                                 vec_matID_counts.rbegin()->first);
-            matIDs[1] = std::max(vec_matID_counts.begin()->first,
-                                 vec_matID_counts.rbegin()->first);
-            vec_junction_nodeID_matIDs.emplace_back(nodeID, matIDs);
+            std::vector<int> junction_matIDs(2);
+            junction_matIDs[0] = std::min(vec_matID_counts.begin()->first,
+                                          vec_matID_counts.rbegin()->first);
+            junction_matIDs[1] = std::max(vec_matID_counts.begin()->first,
+                                          vec_matID_counts.rbegin()->first);
+            vec_junction_nodeID_matIDs.emplace_back(nodeID, junction_matIDs);
         }
     }
 
diff --git a/ProcessLib/RichardsFlow/CreateRichardsFlowMaterialProperties.cpp b/ProcessLib/RichardsFlow/CreateRichardsFlowMaterialProperties.cpp
index a711cb7ffb48b77ec2949b4c7aa8277182bd4c7c..072ae8284de4da8dea1aeeddaf266fe184540c1a 100644
--- a/ProcessLib/RichardsFlow/CreateRichardsFlowMaterialProperties.cpp
+++ b/ProcessLib/RichardsFlow/CreateRichardsFlowMaterialProperties.cpp
@@ -46,7 +46,6 @@ createRichardsFlowMaterialProperties(
 
     // Get porous properties
     std::vector<int> mat_ids;
-    std::vector<int> mat_krel_ids;
     std::vector<std::unique_ptr<MaterialLib::PorousMedium::Permeability>>
         intrinsic_permeability_models;
     std::vector<std::unique_ptr<MaterialLib::PorousMedium::Porosity>>
diff --git a/ProcessLib/SmallDeformation/SmallDeformationFEM.h b/ProcessLib/SmallDeformation/SmallDeformationFEM.h
index 17c3bc214bba80c9677bf63529fe3552b9dc344f..4c3665fb6d3d2107fb27c31feaf7c7e77cf830c2 100644
--- a/ProcessLib/SmallDeformation/SmallDeformationFEM.h
+++ b/ProcessLib/SmallDeformation/SmallDeformationFEM.h
@@ -389,7 +389,6 @@ public:
                 DisplacementDim>::value;
         auto const n_integration_points = _ip_data.size();
 
-        std::vector<double> ip_sigma_values;
         auto sigma_values =
             Eigen::Map<Eigen::Matrix<double, kelvin_vector_size, Eigen::Dynamic,
                                      Eigen::ColMajor> const>(
diff --git a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalFEM.h b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalFEM.h
index 792fcf80b0088301052b1b5a06b5761aa13d2b11..5c0a79ef83df2b567cf59b5f4498828024b3b0ec 100644
--- a/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalFEM.h
+++ b/ProcessLib/SmallDeformationNonlocal/SmallDeformationNonlocalFEM.h
@@ -705,7 +705,6 @@ public:
                 DisplacementDim>::value;
         auto const n_integration_points = _ip_data.size();
 
-        std::vector<double> ip_sigma_values;
         auto sigma_values =
             Eigen::Map<Eigen::Matrix<double, kelvin_vector_size, Eigen::Dynamic,
                                      Eigen::ColMajor> const>(
diff --git a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM.h b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM.h
index dc03604ec6a4f69c9ae03775851791a3f8f3cfbf..b7df421dbce0e8f125a7a72543ed0f7b29421793 100644
--- a/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM.h
+++ b/ProcessLib/ThermoHydroMechanics/ThermoHydroMechanicsFEM.h
@@ -131,7 +131,6 @@ private:
         unsigned const n_integration_points =
             _integration_method.getNumberOfPoints();
 
-        std::vector<double> ip_sigma_values;
         auto sigma_values =
             Eigen::Map<Eigen::Matrix<double, kelvin_vector_size, Eigen::Dynamic,
                                      Eigen::ColMajor> const>(
diff --git a/ProcessLib/TimeLoop.cpp b/ProcessLib/TimeLoop.cpp
index ba4850a7fc03c263b445da3183bc325e809f5140..b8c3e4756e52dabb486775355f17653cfd5bb45f 100644
--- a/ProcessLib/TimeLoop.cpp
+++ b/ProcessLib/TimeLoop.cpp
@@ -354,11 +354,10 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t,
         }
 
         auto& time_disc = ppd.time_disc;
-        auto& mat_strg = *ppd.mat_strg;
         auto& x = *_process_solutions[i];
         if (all_process_steps_accepted)
         {
-            time_disc->pushState(t, x, mat_strg);
+            time_disc->pushState(t, x, *ppd.mat_strg);
         }
         else
         {