diff --git a/GeoLib/AnalyticalGeometry.cpp b/GeoLib/AnalyticalGeometry.cpp
index 0332b41af874e92cdfd1b082b19bfb0e4bdabe13..aa862d189c92babd24b88ba65de6fb60de5704eb 100644
--- a/GeoLib/AnalyticalGeometry.cpp
+++ b/GeoLib/AnalyticalGeometry.cpp
@@ -442,29 +442,28 @@ void computeAndInsertAllIntersectionPoints(GeoLib::PointVec& pnt_vec,
     }
 }
 
-std::unique_ptr<std::vector<GeoLib::Point*>> rotatePolygonPointsToXY(
-    GeoLib::Polygon const& polygon_in, Eigen::Vector3d& plane_normal)
+std::tuple<std::unique_ptr<std::vector<GeoLib::Point*>>, Eigen::Vector3d>
+rotatePolygonPointsToXY(GeoLib::Polygon const& polygon_in)
 {
     // 1 copy all points
-    auto polygon_pnts = std::make_unique<std::vector<GeoLib::Point*>>();
-    polygon_pnts->reserve(polygon_in.getNumberOfPoints());
+    auto polygon_points = std::make_unique<std::vector<GeoLib::Point*>>();
+    polygon_points->reserve(polygon_in.getNumberOfPoints());
     for (std::size_t k(0); k < polygon_in.getNumberOfPoints(); k++)
     {
-        polygon_pnts->push_back(new GeoLib::Point(*(polygon_in.getPoint(k))));
+        polygon_points->push_back(new GeoLib::Point(*(polygon_in.getPoint(k))));
     }
 
     // 2 rotate points
-    double d_polygon;
-    std::tie(plane_normal, d_polygon) = GeoLib::getNewellPlane(*polygon_pnts);
+    auto [plane_normal, d_polygon] = GeoLib::getNewellPlane(*polygon_points);
     Eigen::Matrix3d const rot_mat =
         GeoLib::computeRotationMatrixToXY(plane_normal);
-    GeoLib::rotatePoints(rot_mat, *polygon_pnts);
+    GeoLib::rotatePoints(rot_mat, *polygon_points);
 
     // 3 set z coord to zero
-    std::for_each(polygon_pnts->begin(), polygon_pnts->end(),
+    std::for_each(polygon_points->begin(), polygon_points->end(),
                   [](GeoLib::Point* p) { (*p)[2] = 0.0; });
 
-    return polygon_pnts;
+    return {std::move(polygon_points), plane_normal};
 }
 
 std::vector<MathLib::Point3d> lineSegmentIntersect2d(
diff --git a/GeoLib/AnalyticalGeometry.h b/GeoLib/AnalyticalGeometry.h
index a14351578b88725222001e84ce1e405f1ce237ba..998d277af8d13a3beb6afae6becd4a2cfbec0061 100644
--- a/GeoLib/AnalyticalGeometry.h
+++ b/GeoLib/AnalyticalGeometry.h
@@ -202,22 +202,21 @@ std::unique_ptr<Point> triangleLineIntersection(
  * pnt_vec. For each intersection an id is returned.  This id is used to split the two
  * intersecting straight line segments in four straight line segments.
  */
-void computeAndInsertAllIntersectionPoints(PointVec &pnt_vec,
-    std::vector<Polyline*> & plys);
+void computeAndInsertAllIntersectionPoints(PointVec& pnt_vec,
+                                           std::vector<Polyline*>& plys);
 
 /**
- * Function rotates a polygon to the xy plane. For this reason, (1) the points of
- * the given polygon are copied, (2) a so called Newell plane is computed
- * (getNewellPlane()) and the points are rotated, (3) for security the
- * \f$z\f$ coordinates of the rotated points are set to zero and finally, (4) a
- * new polygon is constructed using the rotated points.
+ * Function rotates a polygon to the xy plane. For this reason, (1) the points
+ * of the given polygon are copied, (2) a so called Newell plane is computed
+ * (getNewellPlane()) and the points are rotated, (3) for accuracy reasons the
+ * \f$z\f$ coordinates of the rotated points are set to zero
  * \see getNewellPlane()
  * @param polygon_in a copy of the polygon_in polygon will be rotated
- * @param plane_normal the normal of the original Newell plane
- * @return a vector of rotated points
+ * @return vector of rotated points and normal based on the original Newell
+ * plane
  */
-std::unique_ptr<std::vector<GeoLib::Point*>> rotatePolygonPointsToXY(
-    GeoLib::Polygon const& polygon_in, Eigen::Vector3d& plane_normal);
+std::tuple<std::unique_ptr<std::vector<GeoLib::Point*>>, Eigen::Vector3d>
+rotatePolygonPointsToXY(GeoLib::Polygon const& polygon_in);
 
 /// Sorts the vector of segments such that the \f$i\f$-th segment is connected
 /// with the \f$i+1\f$st segment, i.e. the end point of the \f$i\f$-th segment
diff --git a/MeshGeoToolsLib/MeshEditing/MarkNodesOutsideOfPolygon.h b/MeshGeoToolsLib/MeshEditing/MarkNodesOutsideOfPolygon.h
index 1e8ba591114a0c5469eda0a46634929d06ac531c..24d00b01b7cec7fb0ccea6ad40a4dbbc9a7bcf6b 100644
--- a/MeshGeoToolsLib/MeshEditing/MarkNodesOutsideOfPolygon.h
+++ b/MeshGeoToolsLib/MeshEditing/MarkNodesOutsideOfPolygon.h
@@ -24,9 +24,8 @@ std::vector<bool> markNodesOutSideOfPolygon(
     std::vector<MeshLib::Node*> const& nodes, GeoLib::Polygon const& polygon)
 {
     // *** rotate polygon points to xy-plane
-    Eigen::Vector3d normal;
-    auto rotated_polygon_points =
-        GeoLib::rotatePolygonPointsToXY(polygon, normal);
+    auto [rotated_polygon_points, normal] =
+        GeoLib::rotatePolygonPointsToXY(polygon);
 
     // *** rotate mesh nodes to xy-plane
     // 1 copy all mesh nodes to GeoLib::Points