diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C
index 77b0f868a6d6d466212f75053b5608afbf575ede..fd7600017d89636f8c082956f4b16b712b44318c 100644
--- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C
+++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C
@@ -179,16 +179,15 @@ bool Foam::autoDensity::combinedWellInside
 }
 
 
-void Foam::autoDensity::recurseAndFill
+Foam::label Foam::autoDensity::recurseAndFill
 (
     DynamicList<Vb::Point>& initialPoints,
     const treeBoundBox& bb,
     label levelLimit,
-    word recursionName,
-    label& nRecursionLevels
+    word recursionName
 ) const
 {
-    nRecursionLevels++;
+    label maxDepth = 0;
 
     for (direction i = 0; i < 8; i++)
     {
@@ -202,14 +201,18 @@ void Foam::autoDensity::recurseAndFill
         {
             if (levelLimit > 0)
             {
-                recurseAndFill
-                (
-                    initialPoints,
-                    subBB,
-                    levelLimit - 1,
-                    newName,
-                    nRecursionLevels
-                );
+                maxDepth =
+                    max
+                    (
+                        maxDepth,
+                        recurseAndFill
+                        (
+                            initialPoints,
+                            subBB,
+                            levelLimit - 1,
+                            newName
+                        )
+                    );
             }
             else
             {
@@ -226,14 +229,18 @@ void Foam::autoDensity::recurseAndFill
 
                 if (!fillBox(initialPoints, subBB, true))
                 {
-                    recurseAndFill
-                    (
-                        initialPoints,
-                        subBB,
-                        levelLimit - 1,
-                        newName,
-                        nRecursionLevels
-                    );
+                    maxDepth =
+                        max
+                        (
+                            maxDepth,
+                            recurseAndFill
+                            (
+                                initialPoints,
+                                subBB,
+                                levelLimit - 1,
+                                newName
+                            )
+                        );
                 }
             }
         }
@@ -252,14 +259,18 @@ void Foam::autoDensity::recurseAndFill
 
             if (!fillBox(initialPoints, subBB, false))
             {
-                recurseAndFill
-                (
-                    initialPoints,
-                    subBB,
-                    levelLimit - 1,
-                    newName,
-                    nRecursionLevels
-                );
+                maxDepth =
+                    max
+                    (
+                        maxDepth,
+                        recurseAndFill
+                        (
+                            initialPoints,
+                            subBB,
+                            levelLimit - 1,
+                            newName
+                        )
+                    );
             }
         }
         else
@@ -274,6 +285,8 @@ void Foam::autoDensity::recurseAndFill
             }
         }
     }
+
+    return maxDepth + 1;
 }
 
 
@@ -925,15 +938,12 @@ List<Vb::Point> autoDensity::initialPoints() const
         Pout<< "    Filling box " << hierBB << endl;
     }
 
-    label nRecursionLevels = 0;
-
-    recurseAndFill
+    label maxDepth = recurseAndFill
     (
         initialPoints,
         hierBB,
         minLevels_ - 1,
-        "recursionBox",
-        nRecursionLevels
+        "recursionBox"
     );
 
     initialPoints.shrink();
@@ -953,7 +963,7 @@ List<Vb::Point> autoDensity::initialPoints() const
         << scalar(nInitialPoints)/scalar(max(globalTrialPoints_, 1))
         << " success rate" << nl
         << indent
-        << returnReduce(nRecursionLevels, maxOp<label>())
+        << returnReduce(maxDepth, maxOp<label>())
         << " levels of recursion (maximum)"
         << decrIndent << decrIndent
         << endl;
diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.H
index 8a7fe5805de68c98c98f86abfc3688f96b0555d6..35be0c8991dcece6f209895d52ce23b15f17b393 100644
--- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.H
+++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.H
@@ -114,13 +114,12 @@ private:
         ) const;
 
         //- Descend into octants of the supplied bound box
-        void recurseAndFill
+        label recurseAndFill
         (
             DynamicList<Vb::Point>& initialPoints,
             const treeBoundBox& bb,
             label levelLimit,
-            word recursionName,
-            label& nRecursionLevels
+            word recursionName
         ) const;
 
         //- Fill the given box, optionally filling surface overlapping boxes.