diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
index 4bb6512a35fbaa331ec7753811f43c2330981143..791f68cf98b971857449ff053c754adb0e8e2350 100644
--- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
+++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
@@ -28,6 +28,9 @@ Description
     Renumbers the cell list in order to reduce the bandwidth, reading and
     renumbering all fields from all the time directories.
 
+    By default uses bandCompression (CuthillMcKee) but will
+    read system/renumberMeshDict if present and use the method from there.
+
 \*---------------------------------------------------------------------------*/
 
 #include "argList.H"
@@ -41,6 +44,7 @@ Description
 #include "decompositionMethod.H"
 #include "renumberMethod.H"
 #include "zeroGradientFvPatchFields.H"
+#include "CuthillMcKeeRenumber.H"
 
 using namespace Foam;
 
@@ -535,20 +539,33 @@ int main(int argc, char *argv[])
 
 
     // Construct renumberMethod
-    IOdictionary renumberDict
+    IOobject io
     (
-        IOobject
-        (
-            "renumberMeshDict",
-            runTime.system(),
-            mesh,
-            IOobject::MUST_READ_IF_MODIFIED,
-            IOobject::NO_WRITE
-        )
+        "renumberMeshDict",
+        runTime.system(),
+        mesh,
+        IOobject::MUST_READ_IF_MODIFIED,
+        IOobject::NO_WRITE
     );
-    autoPtr<renumberMethod> renumberPtr = renumberMethod::New(renumberDict);
 
-    Info<< "Selecting renumberMethod " << renumberPtr().type() << endl;
+    autoPtr<renumberMethod> renumberPtr;
+
+    if (io.headerOk())
+    {
+        Info<< "Detected local " << runTime.system()/io.name() << "." << nl
+            << "Using this to select renumberMethod." << nl << endl;
+        renumberPtr = renumberMethod::New(IOdictionary(io));
+    }
+    else
+    {
+        Info<< "No local " << runTime.system()/io.name()
+            << " dictionary found. Using default renumberMethod." << nl
+            << endl;
+        dictionary renumberDict;
+        renumberPtr.reset(new CuthillMcKeeRenumber(renumberDict));
+    }
+
+    Info<< "Selecting renumberMethod " << renumberPtr().type() << nl << endl;
 
 
 
@@ -641,6 +658,7 @@ int main(int argc, char *argv[])
     PtrList<surfaceTensorField> stFlds;
     ReadFields(mesh, objects, stFlds);
 
+    Info<< endl;
 
     // From renumbering:
     // - from new cell/face back to original cell/face
diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMeshDict b/applications/utilities/mesh/manipulation/renumberMesh/renumberMeshDict
index 7cd0fb8c5168a8d5eb3c7bcf3b958b2e24173c56..7ff33fc530ed8f5303ed060a89fd3dfe9094f0f3 100644
--- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMeshDict
+++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMeshDict
@@ -37,11 +37,11 @@ manualCoeffs
 springCoeffs
 {
     // Maximum jump of cell indices. Is fraction of number of cells
-    maxCo 0.1;
+    maxCo 0.01;
 
     // Limit the amount of movement; the fraction maxCo gets decreased
     // with every iteration
-    freezeFraction 0.9;
+    freezeFraction 0.999;
 
     // Maximum number of iterations
     maxIter 1000;
diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H
index 211d9148e941d6a6a799f149265dcecaadea0dae..62d6f4a5e1e8b6d2013dcc459cc3c657caf61c61 100644
--- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H
+++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H
@@ -159,7 +159,7 @@ public:
         labelList findIndices
         (
             const keyType&,
-            const bool usePatchGroups = false
+            const bool usePatchGroups = true
         ) const;
 
         //- Return patch index for the first match, return -1 if not found
@@ -184,7 +184,7 @@ public:
         (
             const UList<wordRe>& patchNames,
             const bool warnNotFound = true,
-            const bool usePatchGroups = false
+            const bool usePatchGroups = true
         ) const;
 
         //- Check whether all procs have all patches and in same order. Return
diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C
index 01e8c984ec0497a34495ae2e87e1eb0adb7c050b..7f11fb638d1dfcea7b7181169a528bb557c73e3c 100644
--- a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C
+++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C
@@ -34,7 +34,6 @@ License
 #include "polyModifyFace.H"
 #include "polyAddCell.H"
 #include "globalIndex.H"
-#include "dummyTransform.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H
index 40038efeed18ae3d528e3d53f8c2816760fd8cd2..2b7c97478ecfbe204648d2d5ee897740797f0b8c 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H
@@ -38,7 +38,9 @@ Description
 
             code
             #{
-                operator==(min(10, 0.1*this->db().time().value()));
+                this->refValue() = min(10, 0.1*this->db().time().value());
+                this->refGrad() = vector::zero;
+                this->valueFraction() = 1.0;
             #};
 
             //codeInclude
@@ -58,13 +60,15 @@ Description
     which would have a corresponding entry
 
     \verbatim
-    rampedMixed
-    {
-        code
-        #{
-            operator==(min(10, 0.1*this->db().time().value()));
-        #};
-    }
+        rampedMixed
+        {
+            code
+            #{
+                this->refValue() = min(10, 0.1*this->db().time().value());
+                this->refGrad() = vector::zero;
+                this->valueFraction() = 1.0;
+            #};
+        }
     \endverbatim
 
 SeeAlso
diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
index f442f72827f435ebd68e977fea872bf4c5fd6ce2..67d4fec174ed7203a3ba8735cb68a387d71289e8 100644
--- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
+++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
@@ -47,6 +47,7 @@ Description
 #include "IOmanip.H"
 #include "globalIndex.H"
 #include "DynamicField.H"
+#include "PatchTools.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
@@ -369,7 +370,16 @@ void Foam::autoLayerDriver::handleFeatureAngle
         autoPtr<OFstream> str;
         if (debug)
         {
-            str.reset(new OFstream(mesh.time().path()/"featureEdges.obj"));
+            str.reset
+            (
+                new OFstream
+                (
+                    mesh.time().path()
+                  / "featureEdges_"
+                  + meshRefiner_.timeName()
+                  + ".obj"
+                )
+            );
             Info<< "Writing feature edges to " << str().name() << endl;
         }
 
@@ -1220,49 +1230,19 @@ void Foam::autoLayerDriver::getPatchDisplacement
     const vectorField& faceNormals = pp.faceNormals();
     const labelListList& pointFaces = pp.pointFaces();
     const pointField& localPoints = pp.localPoints();
-    const labelList& meshPoints = pp.meshPoints();
 
     // Determine pointNormal
     // ~~~~~~~~~~~~~~~~~~~~~
 
-    pointField pointNormals(pp.nPoints(), vector::zero);
-    {
-        labelList nPointFaces(pp.nPoints(), 0);
-
-        forAll(faceNormals, faceI)
-        {
-            const face& f = pp.localFaces()[faceI];
-
-            forAll(f, fp)
-            {
-                pointNormals[f[fp]] += faceNormals[faceI];
-                nPointFaces[f[fp]] ++;
-            }
-        }
-
-        syncTools::syncPointList
-        (
-            mesh,
-            meshPoints,
-            pointNormals,
-            plusEqOp<vector>(),
-            vector::zero        // null value
-        );
-
-        syncTools::syncPointList
+    pointField pointNormals
+    (
+        PatchTools::pointNormals
         (
             mesh,
-            meshPoints,
-            nPointFaces,
-            plusEqOp<label>(),
-            label(0)            // null value
-        );
-
-        forAll(pointNormals, i)
-        {
-            pointNormals[i] /= nPointFaces[i];
-        }
-    }
+            pp,
+            pp.addressing()
+        )
+    );
 
 
     // Determine local length scale on patch
@@ -2266,7 +2246,11 @@ void Foam::autoLayerDriver::addLayers
     {
         const_cast<Time&>(mesh.time())++;
         Info<< "Writing baffled mesh to " << meshRefiner_.timeName() << endl;
-        mesh.write();
+        meshRefiner_.write
+        (
+            debug,
+            mesh.time().path()/meshRefiner_.timeName()
+        );
     }
 
 
@@ -2732,7 +2716,7 @@ void Foam::autoLayerDriver::addLayers
         {
             dumpDisplacement
             (
-                mesh.time().path()/"layer",
+                mesh.time().path()/"layer_" + meshRefiner_.timeName(),
                 pp(),
                 patchDisp,
                 extrudeStatus
@@ -2744,7 +2728,11 @@ void Foam::autoLayerDriver::addLayers
             // See comment in autoSnapDriver why we should not remove meshPhi
             // using mesh.clearPout().
 
-            mesh.write();
+            meshRefiner_.write
+            (
+                debug,
+                mesh.time().path()/meshRefiner_.timeName()
+            );
         }
 
 
diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
index 614fd204b3c3b78aaed0aa917b6b08c37d133f81..5731562575b50d515d75b641459f4f1ddf200cab 100644
--- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
+++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
@@ -33,6 +33,9 @@ Description
 #include "motionSmoother.H"
 #include "pointData.H"
 #include "PointEdgeWave.H"
+#include "OFstream.H"
+#include "meshTools.H"
+#include "PatchTools.H"
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
@@ -334,11 +337,25 @@ bool Foam::autoLayerDriver::isMaxEdge
         return false;
     }
 
-    v0 /= magV0;
-    v1 /= magV1;
 
-    // Test angle.
-    if ((v0 & v1) < minCos)
+    //- Detect based on vector to nearest point differing for both endpoints
+    //v0 /= magV0;
+    //v1 /= magV1;
+    //
+    //// Test angle.
+    //if ((v0 & v1) < minCos)
+    //{
+    //    return true;
+    //}
+    //else
+    //{
+    //    return false;
+    //}
+
+    //- Detect based on extrusion vector differing for both endpoints
+    //  the idea is that e.g. a sawtooth wall can still be extruded
+    //  successfully as long as it is done all to the same direction.
+    if ((pointWallDist[e[0]].v() & pointWallDist[e[1]].v()) < minCos)
     {
         return true;
     }
@@ -670,7 +687,6 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
     const pointField& points = mesh.points();
 
     const indirectPrimitivePatch& pp = meshMover.patch();
-    const vectorField& faceNormals = pp.faceNormals();
     const labelList& meshPoints = pp.meshPoints();
 
     // Predetermine mesh edges
@@ -700,44 +716,15 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
     // Determine pointNormal
     // ~~~~~~~~~~~~~~~~~~~~~
 
-    pointField pointNormals(pp.nPoints(), vector::zero);
-    {
-        labelList nPointFaces(pp.nPoints(), 0);
-
-        forAll(faceNormals, faceI)
-        {
-            const face& f = pp.localFaces()[faceI];
-
-            forAll(f, fp)
-            {
-                pointNormals[f[fp]] += faceNormals[faceI];
-                nPointFaces[f[fp]] ++;
-            }
-        }
-
-        syncTools::syncPointList
-        (
-            mesh,
-            meshPoints,
-            pointNormals,
-            plusEqOp<vector>(),
-            vector::zero        // null value
-        );
-
-        syncTools::syncPointList
+    pointField pointNormals
+    (
+        PatchTools::pointNormals
         (
             mesh,
-            meshPoints,
-            nPointFaces,
-            plusEqOp<label>(),
-            label(0)            // null value
-        );
-
-        forAll(pointNormals, i)
-        {
-            pointNormals[i] /= nPointFaces[i];
-        }
-    }
+            pp,
+            pp.addressing()
+        )
+    );
 
     // Smooth patch normal vectors
     smoothPatchNormals
@@ -1012,6 +999,26 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
     label numThicknessRatioExclude = 0;
 
     // reduce thickness where thickness/medial axis distance large
+    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    autoPtr<OFstream> str;
+    label vertI = 0;
+    if (debug)
+    {
+        str.reset
+        (
+            new OFstream
+            (
+                mesh.time().path()
+              / "thicknessRatioExcludePoints_"
+              + meshRefiner_.timeName()
+              + ".obj"
+            )
+        );
+        Info<< "Writing points with too large a extrusion distance to "
+            << str().name() << endl;
+    }
+
     forAll(meshPoints, patchPointI)
     {
         if (extrudeStatus[patchPointI] != NOEXTRUDE)
@@ -1025,6 +1032,20 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
             if (thicknessRatio > maxThicknessToMedialRatio)
             {
                 // Truncate thickness.
+                if (debug)
+                {
+                    Pout<< "truncating displacement at "
+                        << mesh.points()[pointI]
+                        << " from " << thickness[patchPointI]
+                        << " to "
+                        <<  0.5
+                           *(
+                                minThickness[patchPointI]
+                               +thickness[patchPointI]
+                            )
+                        << endl;
+                }
+
                 thickness[patchPointI] =
                     0.5*(minThickness[patchPointI]+thickness[patchPointI]);
 
@@ -1033,6 +1054,16 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
                   * patchDisp[patchPointI]
                   / (mag(patchDisp[patchPointI]) + VSMALL);
                 numThicknessRatioExclude++;
+
+                if (str.valid())
+                {
+                    const point& pt = mesh.points()[pointI];
+                    meshTools::writeOBJ(str(), pt);
+                    vertI++;
+                    meshTools::writeOBJ(str(), pt+patchDisp[patchPointI]);
+                    vertI++;
+                    str()<< "l " << vertI-1 << ' ' << vertI << nl;
+                }
             }
         }
     }
@@ -1121,6 +1152,31 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
             *dispVec[pointI];
     }
 
+    if (debug)
+    {
+        const_cast<Time&>(mesh.time())++;
+        Info<< "Writing wanted-displacement mesh (possibly illegal) to "
+            << meshRefiner_.timeName() << endl;
+        pointField oldPoints(mesh.points());
+        meshMover.movePoints
+        (
+            (
+                mesh.points()
+         +      (
+                    meshMover.scale().internalField()
+                  * displacement.internalField()
+                )
+            )()
+        );
+        meshRefiner_.write
+        (
+            debug,
+            mesh.time().path()/meshRefiner_.timeName()
+        );
+        meshMover.movePoints(oldPoints);
+    }
+
+
     // Current faces to check. Gets modified in meshMover.scaleMesh
     labelList checkFaces(identity(mesh.nFaces()));
 
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C
index 1b1b3ba39677b50031986c50821e3ac9a26001ec..296029b7d517b2ad61c66988672bd58ca0be66f8 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C
@@ -31,7 +31,6 @@ License
 #include "pointSet.H"
 #include "faceSet.H"
 #include "indirectPrimitivePatch.H"
-#include "OFstream.H"
 #include "cellSet.H"
 #include "searchableSurfaces.H"
 #include "polyMeshGeometry.H"
diff --git a/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/system/renumberMeshDict b/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/system/renumberMeshDict
deleted file mode 100644
index 9804c39c1600f50018ce9f00cc40eb760f63cc21..0000000000000000000000000000000000000000
--- a/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/system/renumberMeshDict
+++ /dev/null
@@ -1,44 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       dictionary;
-    note        "mesh renumbering dictionary";
-    object      renumberMeshDict;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-method          CuthillMcKee;
-//method          manual;
-//method          random;
-//method          spring;
-
-manualCoeffs
-{
-    // In system directory: old to new labelIOList
-    dataFile "cellMap";
-}
-
-
-springCoeffs
-{
-    // Maximum jump of cell indices. Is fraction of number of cells
-    maxCo 0.1;
-
-    // Limit the amount of movement; the fraction maxCo gets decreased
-    // with every iteration
-    freezeFraction 0.9;
-
-    // Maximum number of iterations
-    maxIter 1000;
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/system/renumberMeshDict b/tutorials/incompressible/simpleFoam/turbineSiting/system/renumberMeshDict
deleted file mode 100644
index 9804c39c1600f50018ce9f00cc40eb760f63cc21..0000000000000000000000000000000000000000
--- a/tutorials/incompressible/simpleFoam/turbineSiting/system/renumberMeshDict
+++ /dev/null
@@ -1,44 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
-| =========                 |                                                 |
-| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  dev                                   |
-|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
-|    \\/     M anipulation  |                                                 |
-\*---------------------------------------------------------------------------*/
-FoamFile
-{
-    version     2.0;
-    format      ascii;
-    class       dictionary;
-    note        "mesh renumbering dictionary";
-    object      renumberMeshDict;
-}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-method          CuthillMcKee;
-//method          manual;
-//method          random;
-//method          spring;
-
-manualCoeffs
-{
-    // In system directory: old to new labelIOList
-    dataFile "cellMap";
-}
-
-
-springCoeffs
-{
-    // Maximum jump of cell indices. Is fraction of number of cells
-    maxCo 0.1;
-
-    // Limit the amount of movement; the fraction maxCo gets decreased
-    // with every iteration
-    freezeFraction 0.9;
-
-    // Maximum number of iterations
-    maxIter 1000;
-}
-
-
-// ************************************************************************* //