diff --git a/README b/README
index 093280c6fbdc88dfbd21a892c3cbbc9f4dbaf46d..bcce7c5da9b06f3fe8d227d9f3002691990040ba 100644
--- a/README
+++ b/README
@@ -14,11 +14,10 @@
   General Public License terms under which you can copy the files.
 
 * System requirements
-  OpenFOAM is developed and tested on Linux, but should work with other Unix
-  style systems.  To check your system setup, execute the foamSystemCheck script
-  in the bin/ directory of the OpenFOAM installation. If no problems are
-  reported, proceed to "3. Installation"; otherwise contact your system
-  administrator.
+  OpenFOAM is developed and tested on Linux, but should work with other POSIX
+  systems.  To check your system setup, execute the foamSystemCheck script in
+  the bin/ directory of the OpenFOAM installation. If no problems are reported,
+  proceed to "3. Installation"; otherwise contact your system administrator.
 
   If the user wishes to run OpenFOAM in 32/64-bit mode they should consult the
   section "Running OpenFOAM in 32-bit mode".
diff --git a/applications/solvers/Lagrangian/uncoupledKinematicParcelFoam/createFields.H b/applications/solvers/Lagrangian/uncoupledKinematicParcelFoam/createFields.H
index 3854911dd91f6c21bf28ea86c9da1b28de654b8c..c76a81ca4666d882442b8c8f09663be378a134d0 100644
--- a/applications/solvers/Lagrangian/uncoupledKinematicParcelFoam/createFields.H
+++ b/applications/solvers/Lagrangian/uncoupledKinematicParcelFoam/createFields.H
@@ -47,11 +47,7 @@
     );
 
     word kinematicCloudName("kinematicCloud");
-
-    if (args.options().found("cloudName"))
-    {
-        kinematicCloudName = args.options()["cloudName"];
-    }
+    args.optionReadIfPresent("cloudName", kinematicCloudName);
 
     Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
     basicKinematicCloud kinematicCloud
diff --git a/applications/solvers/basic/potentialFoam/potentialFoam.C b/applications/solvers/basic/potentialFoam/potentialFoam.C
index 9d2073bf2e3cf324d45b1d5cb6fffbe6fce4b531..49188fcf0086fd314654d0b74c5768ae90c4db37 100644
--- a/applications/solvers/basic/potentialFoam/potentialFoam.C
+++ b/applications/solvers/basic/potentialFoam/potentialFoam.C
@@ -97,7 +97,7 @@ int main(int argc, char *argv[])
     U.write();
     phi.write();
 
-    if (args.options().found("writep"))
+    if (args.optionFound("writep"))
     {
         p.write();
     }
diff --git a/applications/test/List/ListTest.C b/applications/test/List/ListTest.C
index d4834cb1db2b02bc79f4d6e8508e9f3b3361c695..0fee9a9e3b5bd907a611dbad46e91ccd8984a321 100644
--- a/applications/test/List/ListTest.C
+++ b/applications/test/List/ListTest.C
@@ -29,6 +29,8 @@ Description
 \*---------------------------------------------------------------------------*/
 
 #include "OSspecific.H"
+#include "argList.H"
+#include "wordReList.H"
 
 #include "IOstreams.H"
 #include "IStringStream.H"
@@ -38,11 +40,21 @@ Description
 
 using namespace Foam;
 
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 //  Main program:
 
 int main(int argc, char *argv[])
 {
+    argList::noParallel();
+    argList::validOptions.insert("reList", "reList");
+    argList::validOptions.insert("wordList", "wordList");
+    argList::validOptions.insert("stringList", "stringList");
+    argList::validOptions.insert("float", "xx");
+    argList::validOptions.insert("flag", "");
+
+#   include "setRootCase.H"
+
     List<vector> list1(IStringStream("1 ((0 1 2))")());
     Info<< "list1: " << list1 << endl;
 
@@ -69,6 +81,43 @@ int main(int argc, char *argv[])
     Info<< "Elements " << map << " out of " << list3
         << " => " << subList3 << endl;
 
+    wordReList reLst;
+    wordList wLst;
+    stringList sLst;
+
+
+    scalar xxx(-1);
+
+    if (args.optionFound("flag"))
+    {
+        Info<<"-flag:" << args.option("flag") << endl;
+    }
+
+    if (args.optionReadIfPresent<scalar>("float", xxx))
+    {
+        Info<<"read float " << xxx << endl;
+    }
+
+    if (args.optionFound("reList"))
+    {
+        reLst = args.optionReadList<wordRe>("reList");
+    }
+
+    if (args.optionFound("wordList"))
+    {
+        wLst = args.optionReadList<word>("wordList");
+    }
+
+    if (args.optionFound("stringList"))
+    {
+        sLst = args.optionReadList<string>("stringList");
+    }
+
+    Info<< nl
+        << "-reList: " << reLst << nl
+        << "-wordList: " << wLst << nl
+        << "-stringList: " << sLst << endl;
+
     return 0;
 }
 
diff --git a/applications/test/POSIX/Make/files b/applications/test/POSIX/Make/files
new file mode 100644
index 0000000000000000000000000000000000000000..f2f2540e6a8b248b8f80199a293419ec1afec79b
--- /dev/null
+++ b/applications/test/POSIX/Make/files
@@ -0,0 +1,2 @@
+POSIXTest.C
+EXE = $(FOAM_USER_APPBIN)/POSIXTest
diff --git a/applications/test/Unix/Make/options b/applications/test/POSIX/Make/options
similarity index 100%
rename from applications/test/Unix/Make/options
rename to applications/test/POSIX/Make/options
diff --git a/applications/test/Unix/UnixTest.C b/applications/test/POSIX/POSIXTest.C
similarity index 100%
rename from applications/test/Unix/UnixTest.C
rename to applications/test/POSIX/POSIXTest.C
diff --git a/applications/test/Unix/Make/files b/applications/test/Unix/Make/files
deleted file mode 100644
index 6554bfcbb0c4fa955e6b891b285230c2815df207..0000000000000000000000000000000000000000
--- a/applications/test/Unix/Make/files
+++ /dev/null
@@ -1,2 +0,0 @@
-UnixTest.C
-EXE = $(FOAM_USER_APPBIN)/UnixTest
diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C
index e87078cc397294edf650a2fa371d7bb49bdd43ce..d4d6d11539cee0aaa35b20200a3471fb85e01f91 100644
--- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C
+++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C
@@ -465,7 +465,7 @@ int main(int argc, char *argv[])
 
     scalar minLen(readScalar(IStringStream(args.additionalArgs()[0])()));
     scalar angle(readScalar(IStringStream(args.additionalArgs()[1])()));
-    bool overwrite = args.options().found("overwrite");
+    bool overwrite = args.optionFound("overwrite");
 
     scalar maxCos = Foam::cos(angle*180/mathematicalConstant::pi);
 
diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C
index fa244430f6b474da5c561052f81b6e7ff0aaac93..60c94395614766a61d1e1ff49e6b039b5194846d 100644
--- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C
+++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C
@@ -448,19 +448,12 @@ int main(int argc, char *argv[])
     scalar minCos = Foam::cos(featureAngle*mathematicalConstant::pi/180.0);
 
     scalar concaveAngle = defaultConcaveAngle;
-
-    if (args.options().found("concaveAngle"))
-    {
-        concaveAngle = readScalar
-        (
-            IStringStream(args.options()["concaveAngle"])()
-        );
-    }
+    args.optionReadIfPresent("concaveAngle", concaveAngle);
 
     scalar concaveSin = Foam::sin(concaveAngle*mathematicalConstant::pi/180.0);
 
-    bool snapMeshDict = args.options().found("snapMesh");
-    bool overwrite = args.options().found("overwrite");
+    bool snapMeshDict = args.optionFound("snapMesh");
+    bool overwrite = args.optionFound("overwrite");
 
     Info<< "Merging all faces of a cell" << nl
         << "    - which are on the same patch" << nl
diff --git a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C
index 0011d750e5613785d69f54d2a8dff9944b596b23..a78ade8d6d42231a9514b922b821bec35cd75c19 100644
--- a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C
+++ b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C
@@ -336,7 +336,7 @@ int main(int argc, char *argv[])
 #   include "createPolyMesh.H"
     const word oldInstance = mesh.pointsInstance();
 
-    bool overwrite = args.options().found("overwrite");
+    bool overwrite = args.optionFound("overwrite");
 
     Info<< "Reading modifyMeshDict\n" << endl;
 
diff --git a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C
index c18e0af978a147ca1b9b2dc522f6d8773f85b947..77a09ff7b95cf233a65dda49db1d68b539409db5 100644
--- a/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C
+++ b/applications/utilities/mesh/advanced/refineHexMesh/refineHexMesh.C
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
     pointMesh pMesh(mesh);
 
     word cellSetName(args.args()[1]);
-    bool overwrite = args.options().found("overwrite");
+    bool overwrite = args.optionFound("overwrite");
 
     Info<< "Reading cells to refine from cellSet " << cellSetName
         << nl << endl;
diff --git a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C
index 9c608366aae814d6e48c8c331ad76581b25a7ede..a78dade6fd77be41c6f95577118b7c236b75c239 100644
--- a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C
+++ b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
     word patchName(args.additionalArgs()[0]);
 
     scalar weight(readScalar(IStringStream(args.additionalArgs()[1])()));
-    bool overwrite = args.options().found("overwrite");
+    bool overwrite = args.optionFound("overwrite");
 
 
     label patchID = mesh.boundaryMesh().findPatchID(patchName);
@@ -101,11 +101,11 @@ int main(int argc, char *argv[])
     // List of cells to refine
     //
 
-    bool useSet = args.options().found("useSet");
+    bool useSet = args.optionFound("useSet");
 
     if (useSet)
     {
-        word setName(args.options()["useSet"]);
+        word setName(args.option("useSet"));
 
         Info<< "Subsetting cells to cut based on cellSet" << setName << endl
             << endl;
diff --git a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C
index 25b13eba8889f021551daa940dd17cbeb81ff48d..7732c985b8484a2c822c846c3a5b554da162aa80 100644
--- a/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C
+++ b/applications/utilities/mesh/advanced/refinementLevel/refinementLevel.C
@@ -110,7 +110,7 @@ int main(int argc, char *argv[])
         << " to allow for some truncation error."
         << nl << endl;
 
-    bool readLevel = args.options().found("readLevel");
+    bool readLevel = args.optionFound("readLevel");
 
     const scalarField& vols = mesh.cellVolumes();
 
diff --git a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C
index 26ee404fe8d79809c9519d27d52b825d3e45fe28..c3fcc727d2087f05a8cc8e0beff782a063a0e30b 100644
--- a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C
+++ b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C
@@ -57,7 +57,7 @@ int main(int argc, char *argv[])
 #   include "createMesh.H"
     const word oldInstance = mesh.pointsInstance();
 
-    bool overwrite = args.options().found("overwrite");
+    bool overwrite = args.optionFound("overwrite");
 
     word setName(args.additionalArgs()[0]);
 
diff --git a/applications/utilities/mesh/advanced/splitCells/splitCells.C b/applications/utilities/mesh/advanced/splitCells/splitCells.C
index 6424745e9ad8df6cbcbc1228edbcb2a21fda4f21..3aa649ee8be4314f01e6e10789b880f59fad5435 100644
--- a/applications/utilities/mesh/advanced/splitCells/splitCells.C
+++ b/applications/utilities/mesh/advanced/splitCells/splitCells.C
@@ -542,23 +542,19 @@ int main(int argc, char *argv[])
     scalar minCos = Foam::cos(radAngle);
     scalar minSin = Foam::sin(radAngle);
 
-    bool readSet = args.options().found("set");
-    bool geometry = args.options().found("geometry");
-    bool overwrite = args.options().found("overwrite");
+    bool readSet   = args.optionFound("set");
+    bool geometry  = args.optionFound("geometry");
+    bool overwrite = args.optionFound("overwrite");
 
     scalar edgeTol = 0.2;
-
-    if (args.options().found("tol"))
-    {
-        edgeTol = readScalar(IStringStream(args.options()["tol"])());
-    }
+    args.optionReadIfPresent("tol", edgeTol);
 
     Info<< "Trying to split cells with internal angles > feature angle\n" << nl
         << "featureAngle      : " << featureAngle << nl
         << "edge snapping tol : " << edgeTol << nl;
     if (readSet)
     {
-        Info<< "candidate cells   : cellSet " << args.options()["set"] << nl;
+        Info<< "candidate cells   : cellSet " << args.option("set") << nl;
     }
     else
     {
@@ -586,7 +582,7 @@ int main(int argc, char *argv[])
     if (readSet)
     {
         // Read cells to cut from cellSet
-        cellSet cells(mesh, args.options()["set"]);
+        cellSet cells(mesh, args.option("set"));
 
         cellsToCut = cells;
     }
diff --git a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
index 149d9af19b9650891a33b36b2585a97cd9060037..2fffcaa813f65749989388733813571eaa9bdcdf 100644
--- a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
+++ b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
@@ -1,4 +1,4 @@
-/*---------------------------------------------------------------------------*\
+/*--------------------------------*- C++ -*----------------------------------*\
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
@@ -246,10 +246,7 @@ int main(int argc, char *argv[])
     }
 
     scalar scaleFactor = 1.0;
-    if (args.options().found("scale"))
-    {
-        scaleFactor = atof(args.options()["scale"].c_str());
-    }
+    args.optionReadIfPresent("scale", scaleFactor);
 
 #   include "createTime.H"
 
diff --git a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C
index df84d13a79cff7c21c9e16742a95f60b5130d492..d193a481330205b146f4c3afe20ec4fab7ea1a25 100644
--- a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C
+++ b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C
@@ -60,10 +60,7 @@ int main(int argc, char *argv[])
     }
 
     scalar scaleFactor = 1.0;
-    if (args.options().found("scale"))
-    {
-        scaleFactor = atof(args.options()["scale"].c_str());
-    }
+    args.optionReadIfPresent("scale", scaleFactor);
 
 #   include "createTime.H"
 
diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L
index a8606e0df962c51b1de0389facd8f764b3e36751..bbaab8b01d5aaa463e01049c03dab2306326ce9f 100644
--- a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L
+++ b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L
@@ -1,4 +1,4 @@
-/*---------------------------------------------------------------------------*\
+/*--------------------------------*- C++ -*----------------------------------*\
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
@@ -760,21 +760,18 @@ int main(int argc, char *argv[])
         FatalError.exit();
     }
 
-    if (args.options().found("scale"))
-    {
-        scaleFactor = atof(args.options()["scale"].c_str());
-    }
+    args.optionReadIfPresent("scale", scaleFactor);
 
     HashSet<word> ignoreCellGroups;
-    if (args.options().found("ignoreCellGroups"))
+    if (args.optionFound("ignoreCellGroups"))
     {
-        IStringStream(args.options()["ignoreCellGroups"])() >> ignoreCellGroups;
+        args.optionLookup("ignoreCellGroups")() >> ignoreCellGroups;
     }
 
     HashSet<word> ignoreFaceGroups;
-    if (args.options().found("ignoreFaceGroups"))
+    if (args.optionFound("ignoreFaceGroups"))
     {
-        IStringStream(args.options()["ignoreFaceGroups"])() >> ignoreFaceGroups;
+        args.optionLookup("ignoreFaceGroups")() >> ignoreFaceGroups;
     }
 
 #   include "createTime.H"
diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
index 7b385bfe0615ab2cec06838f4ca6fe0992647c58..d1afc4523a5e0ba97cacaa6abd9a4eeecdeebfa7 100644
--- a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
+++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
@@ -879,13 +879,10 @@ int main(int argc, char *argv[])
     }
 
     scalar scaleFactor = 1.0;
-    if (args.options().found("scale"))
-    {
-        scaleFactor = atof(args.options()["scale"].c_str());
-    }
+    args.optionReadIfPresent("scale", scaleFactor);
 
-    bool writeSets = args.options().found("writeSets");
-    bool writeZones = args.options().found("writeZones");
+    bool writeSets  = args.optionFound("writeSets");
+    bool writeZones = args.optionFound("writeZones");
 
 #   include "createTime.H"
 
diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C
index 5cdbcb77e89f0d4a47aefdc6e2a80b90fc217492..b36ec777694b35d4a640212171062ad026020254 100644
--- a/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C
+++ b/applications/utilities/mesh/conversion/foamToStarMesh/foamToStarMesh.C
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
     instantList timeDirs = timeSelector::select0(runTime, args);
 
     bool surfaceOnly = false;
-    if (args.options().found("surface") or args.options().found("tri"))
+    if (args.optionFound("surface") || args.optionFound("tri"))
     {
         surfaceOnly = true;
     }
@@ -98,16 +98,15 @@ int main(int argc, char *argv[])
         exportName = meshWriter::defaultSurfaceName;
     }
 
-    if (args.options().found("case"))
+    if (args.optionFound("case"))
     {
         exportName += '-' + args.globalCaseName();
     }
 
     // default: rescale from [m] to [mm]
     scalar scaleFactor = 1000;
-    if (args.options().found("scale"))
+    if (args.optionReadIfPresent("scale", scaleFactor))
     {
-        scaleFactor = readScalar(IStringStream(args.options()["scale"])());
         if (scaleFactor <= 0)
         {
             scaleFactor = 1;
@@ -129,7 +128,7 @@ int main(int argc, char *argv[])
         {
             meshWriters::STARCD writer(mesh, scaleFactor);
 
-            if (args.options().found("noBnd"))
+            if (args.optionFound("noBnd"))
             {
                 writer.noBoundary();
             }
@@ -142,7 +141,7 @@ int main(int argc, char *argv[])
 
             if (surfaceOnly)
             {
-                if (args.options().found("tri"))
+                if (args.optionFound("tri"))
                 {
                     writer.writeSurface(meshName, true);
                 }
diff --git a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
index 6c61a219f3996458a72bd57ae7c4b307a6a70b9e..f815e81b5327c2a86fc4407831a48603c995130b 100644
--- a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
+++ b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
@@ -1,4 +1,4 @@
-/*---------------------------------------------------------------------------*\
+/*--------------------------------*- C++ -*----------------------------------*\
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
@@ -646,10 +646,7 @@ int main(int argc, char *argv[])
     }
 
     scalar scaleFactor = 1.0;
-    if (args.options().found("scale"))
-    {
-        scaleFactor = atof(args.options()["scale"].c_str());
-    }
+    args.optionReadIfPresent("scale", scaleFactor);
 
 #   include "createTime.H"
 
diff --git a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
index 62edc15af03dd7db103ff4fae7be2a5f184ca6eb..68eb9c46cfc2cb6b3d22b26e1d4c960382cee03e 100644
--- a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
+++ b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
@@ -689,7 +689,7 @@ int main(int argc, char *argv[])
 
     fileName mshName(args.additionalArgs()[0]);
 
-    bool keepOrientation = args.options().found("keepOrientation");
+    bool keepOrientation = args.optionFound("keepOrientation");
 
     // Storage for points
     pointField points;
diff --git a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
index 520be5b1463205fceef61a57facf1ea2c36a6c79..6a9d85ba301b115c2a4d02f1fa19895598e1a373 100644
--- a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
+++ b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
@@ -852,7 +852,7 @@ int main(int argc, char *argv[])
 
 
     // For debugging: dump boundary faces as triSurface
-    if (args.options().found("dump"))
+    if (args.optionFound("dump"))
     {
         DynamicList<labelledTri> triangles(boundaryFaces.size());
 
diff --git a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C
index 235f8986c601e0f4f849c6fb9587017f18f8a8e6..1da7ba049e4202ae5e2065fe3f9be3fd0a5502a6 100644
--- a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C
+++ b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C
@@ -68,15 +68,15 @@ int main(int argc, char *argv[])
 #   include "createTime.H"
 
     fileName kivaFileName("otape17");
-    if (args.options().found("file"))
+    if (args.optionFound("file"))
     {
-        kivaFileName = args.options()["file"];
+        kivaFileName = args.option("file");
     }
 
     kivaVersions kivaVersion = kiva3v;
-    if (args.options().found("version"))
+    if (args.optionFound("version"))
     {
-        word kivaVersionName = args.options()["version"];
+        word kivaVersionName = args.option("version");
 
         if (kivaVersionName == "kiva3")
         {
@@ -99,10 +99,7 @@ int main(int argc, char *argv[])
     }
 
     scalar zHeadMin = -GREAT;
-    if (args.options().found("zHeadMin"))
-    {
-        zHeadMin = atof(args.options()["zHeadMin"].c_str());
-    }
+    args.optionReadIfPresent("zHeadMin", zHeadMin);
 
 #   include "readKivaGrid.H"
 
diff --git a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C
index 2a48971abd5740020e2b58b9910784ec6d33331a..df438b356651c8cdbb209eb9a521c2ade344369e 100644
--- a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C
+++ b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C
@@ -62,14 +62,12 @@ int main(int argc, char *argv[])
 #   include "setRootCase.H"
 #   include "createTime.H"
 
-    bool readHex(args.options().found("hex"));
+    bool readHex = args.optionFound("hex");
 
     fileName mshFile(args.additionalArgs()[0]);
-
     IFstream mshStream(mshFile);
 
     label nCells;
-
     mshStream >> nCells;
 
     if (readHex)
diff --git a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C
index 644efa906c368e1efcd58f89f1c72427793cdcfb..b1ea5df43fb096dc70fcbf46c73643a42a494436 100644
--- a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C
+++ b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C
@@ -71,18 +71,14 @@ int main(int argc, char *argv[])
     }
 
     scalar scaleFactor = 1.0;
-    if (args.options().found("scale"))
-    {
-        scaleFactor = atof(args.options()["scale"].c_str());
-    }
+    args.optionReadIfPresent("scale", scaleFactor);
 
-    bool readBlank = !args.options().found("noBlank");
-    bool singleBlock = args.options().found("singleBlock");
-    scalar twoDThicknes = -1;
-    if (args.options().found("2D"))
+    bool readBlank = !args.optionFound("noBlank");
+    bool singleBlock = args.optionFound("singleBlock");
+    scalar twoDThickness = -1;
+    if (args.optionReadIfPresent("2D", twoDThickness))
     {
-        twoDThicknes = readScalar(IStringStream(args.options()["2D"])());
-        Info<< "Reading 2D case by extruding points by " << twoDThicknes
+        Info<< "Reading 2D case by extruding points by " << twoDThickness
             << " in z direction." << nl << endl;
     }
 
@@ -114,7 +110,7 @@ int main(int argc, char *argv[])
 
         forAll (blocks, blockI)
         {
-            if (twoDThicknes > 0)
+            if (twoDThickness > 0)
             {
                 // Fake second set of points (done in readPoints below)
                 plot3dFile >> nx >> ny;
@@ -139,7 +135,7 @@ int main(int argc, char *argv[])
     forAll (blocks, blockI)
     {
         Info<< "block " << blockI << ":" << nl;
-        blocks[blockI].readPoints(readBlank, twoDThicknes, plot3dFile);
+        blocks[blockI].readPoints(readBlank, twoDThickness, plot3dFile);
         sumPoints += blocks[blockI].nBlockPoints();
         nMeshCells += blocks[blockI].nBlockCells();
         Info<< nl;
diff --git a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C
index ffb2cb7daae965e8b624ce720860fd36a0304a02..e2bf673ce26375af9422b21a9e5ca3451988c247 100644
--- a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C
+++ b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C
@@ -45,6 +45,7 @@ Description
 
 #include "argList.H"
 #include "Time.H"
+#include "timeSelector.H"
 #include "fvMesh.H"
 #include "mathematicalConstants.H"
 #include "polyTopoChange.H"
@@ -340,7 +341,8 @@ void dumpFeatures
 int main(int argc, char *argv[])
 {
     argList::noParallel();
-#   include "addTimeOptions.H"
+    timeSelector::addOptions(true, false);
+
     argList::validArgs.append("feature angle[0-180]");
     argList::validOptions.insert("splitAllFaces", "");
     argList::validOptions.insert("doNotPreserveFaceZones", "");
@@ -349,13 +351,10 @@ int main(int argc, char *argv[])
 #   include "setRootCase.H"
 #   include "createTime.H"
 
-    // Get times list
-    instantList Times = runTime.times();
-
-#   include "checkTimeOptions.H"
-    runTime.setTime(Times[startTime], startTime);
+    instantList timeDirs = timeSelector::select0(runTime, args);
 
 #   include "createMesh.H"
+
     const word oldInstance = mesh.pointsInstance();
 
     // Mark boundary edges and points.
@@ -381,9 +380,9 @@ int main(int argc, char *argv[])
         << endl;
 
 
-    const bool splitAllFaces = args.options().found("splitAllFaces");
-    const bool overwrite = args.options().found("overwrite");
-    const bool doNotPreserveFaceZones = args.options().found
+    const bool splitAllFaces = args.optionFound("splitAllFaces");
+    const bool overwrite = args.optionFound("overwrite");
+    const bool doNotPreserveFaceZones = args.optionFound
     (
         "doNotPreserveFaceZones"
     );
diff --git a/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C b/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C
index d676581a576f2d47c6fbce09de18a0d9dd96a8ab..8095529d3270eeb39c7bbe16771b388aa50b0ced 100644
--- a/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C
+++ b/applications/utilities/mesh/conversion/sammToFoam/sammToFoam.C
@@ -51,10 +51,7 @@ int main(int argc, char *argv[])
     }
 
     scalar scaleFactor = 1.0;
-    if (args.options().found("scale"))
-    {
-        scaleFactor = atof(args.options()["scale"].c_str());
-    }
+    args.optionReadIfPresent("scale", scaleFactor);
 
 #   include "createTime.H"
 
diff --git a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C
index c0d66dbb5872fc61686e8fa3a15ffa975de05232..c4f8d6efc6a72d4ab79e15442eaf2543d27b1caa 100644
--- a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C
+++ b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C
@@ -68,27 +68,26 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
     Time runTime(args.rootPath(), args.caseName());
-    stringList const& params = args.additionalArgs();
+    const stringList& params = args.additionalArgs();
 
     // default rescale from [mm] to [m]
     scalar scaleFactor = 0.001;
-    if (args.options().found("scale"))
+    if (args.optionReadIfPresent("scale", scaleFactor))
     {
-        scaleFactor = readScalar(IStringStream(args.options()["scale"])());
         if (scaleFactor <= 0)
         {
             scaleFactor = 1;
         }
     }
-
-    if (args.options().found("solids"))
+    
+    if (args.optionFound("solids"))
     {
         meshReaders::STARCD::keepSolids = true;
     }
 
     // default to binary output, unless otherwise specified
     IOstream::streamFormat format = IOstream::BINARY;
-    if (args.options().found("ascii"))
+    if (args.optionFound("ascii"))
     {
         format = IOstream::ASCII;
     }
diff --git a/applications/utilities/mesh/conversion/starToFoam/starToFoam.C b/applications/utilities/mesh/conversion/starToFoam/starToFoam.C
index 2f7d9c89803261af1b70735996c97db74aa0c0f0..2c2aeaa76b5ba2cc2a3350c6ebe7075e21ff3f23 100644
--- a/applications/utilities/mesh/conversion/starToFoam/starToFoam.C
+++ b/applications/utilities/mesh/conversion/starToFoam/starToFoam.C
@@ -51,10 +51,7 @@ int main(int argc, char *argv[])
     }
 
     scalar scaleFactor = 1.0;
-    if (args.options().found("scale"))
-    {
-        scaleFactor = atof(args.options()["scale"].c_str());
-    }
+    args.optionReadIfPresent("scale", scaleFactor);
 
 #   include "createTime.H"
 
diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
index 486041c71457b39787121d453d06c3bc7fa52b98..9e9426d0852fe093410030730bee34659d2aaf79 100644
--- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
+++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
 #   include "createTime.H"
 
 
-    bool readFaceFile = !args.options().found("noFaceFile");
+    bool readFaceFile = !args.optionFound("noFaceFile");
 
     fileName prefix(args.additionalArgs()[0]);
 
diff --git a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C
index 9eaaf2c199ffb24ce064ab888d5739b8ec63160e..e1d571e0816f4f146decba57af55579348a03a2f 100644
--- a/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C
+++ b/applications/utilities/mesh/conversion/writeMeshObj/writeMeshObj.C
@@ -350,12 +350,12 @@ int main(int argc, char *argv[])
 #   include "createTime.H"
     runTime.functionObjects().off();
 
-    bool patchFaces = args.options().found("patchFaces");
-    bool doCell = args.options().found("cell");
-    bool doPoint = args.options().found("point");
-    bool doFace = args.options().found("face");
-    bool doCellSet = args.options().found("cellSet");
-    bool doFaceSet = args.options().found("faceSet");
+    bool patchFaces = args.optionFound("patchFaces");
+    bool doCell     = args.optionFound("cell");
+    bool doPoint    = args.optionFound("point");
+    bool doFace     = args.optionFound("face");
+    bool doCellSet  = args.optionFound("cellSet");
+    bool doFaceSet  = args.optionFound("faceSet");
 
 
     Info<< "Writing mesh objects as .obj files such that the object"
@@ -383,22 +383,19 @@ int main(int argc, char *argv[])
             }
             else if (doCell)
             {
-                label cellI =
-                    readLabel(IStringStream(args.options()["cell"])());
+                label cellI = args.optionRead<label>("cell");
 
                 writePoints(mesh, cellI, runTime.timeName());
             }
             else if (doPoint)
             {
-                label pointI =
-                    readLabel(IStringStream(args.options()["point"])());
+                label pointI = args.optionRead<label>("point");
 
                 writePointCells(mesh, pointI, runTime.timeName());
             }
             else if (doFace)
             {
-                label faceI =
-                    readLabel(IStringStream(args.options()["face"])());
+                label faceI = args.optionRead<label>("face");
 
                 fileName fName
                 (
@@ -420,7 +417,7 @@ int main(int argc, char *argv[])
             }
             else if (doCellSet)
             {
-                word setName(args.options()["cellSet"]);
+                word setName(args.option("cellSet"));
 
                 cellSet cells(mesh, setName);
 
@@ -432,7 +429,7 @@ int main(int argc, char *argv[])
             }
             else if (doFaceSet)
             {
-                word setName(args.options()["faceSet"]);
+                word setName(args.option("faceSet"));
 
                 faceSet faces(mesh, setName);
 
diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
index 815f082ec7dd179b6a1aba308a0c8c1d4c6c6b1a..1bcee69984d1f8b32fed33fc9be7b434e78f2954 100644
--- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
+++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
@@ -83,10 +83,10 @@ int main(int argc, char *argv[])
     word regionName;
     fileName polyMeshDir;
 
-    if (args.options().found("region"))
+    if (args.optionFound("region"))
     {
         // constant/<region>/polyMesh/blockMeshDict
-        regionName  = args.options()["region"];
+        regionName  = args.option("region");
         polyMeshDir = regionName/polyMesh::meshSubDir;
 
         Info<< nl << "Generating mesh for region " << regionName << endl;
@@ -100,9 +100,9 @@ int main(int argc, char *argv[])
 
     autoPtr<IOobject> meshDictIoPtr;
 
-    if (args.options().found("dict"))
+    if (args.optionFound("dict"))
     {
-        fileName dictPath(args.options()["dict"]);
+        fileName dictPath(args.option("dict"));
 
         meshDictIoPtr.set
         (
@@ -110,7 +110,7 @@ int main(int argc, char *argv[])
             (
                 (
                     isDir(dictPath)
-                  ? dictPath/dictName 
+                  ? dictPath/dictName
                   : dictPath
                 ),
                 runTime,
@@ -153,7 +153,7 @@ int main(int argc, char *argv[])
     blockMesh blocks(meshDict);
 
 
-    if (args.options().found("blockTopology"))
+    if (args.optionFound("blockTopology"))
     {
         // Write mesh as edges.
         {
diff --git a/applications/utilities/mesh/generation/extrude2DMesh/doExtrude2DMesh.C b/applications/utilities/mesh/generation/extrude2DMesh/doExtrude2DMesh.C
index 2e0c16a5116843d70ddf5c3266900a09f4d13292..c71f91079c8cda68c77b86054a9d8cf01c2c4a27 100644
--- a/applications/utilities/mesh/generation/extrude2DMesh/doExtrude2DMesh.C
+++ b/applications/utilities/mesh/generation/extrude2DMesh/doExtrude2DMesh.C
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
     const word oldInstance = mesh.pointsInstance();
 
     scalar thickness(readScalar(IStringStream(args.additionalArgs()[0])()));
-    bool overwrite = args.options().found("overwrite");
+    bool overwrite = args.optionFound("overwrite");
 
 
     // Check that mesh is 2D
diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C
index 37860e27b25d217c4ddef3a765058fa6f7b1d8fb..95ec6c5b8ae8e12a02dd5df4b63cbefc9537eac2 100644
--- a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C
+++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C
@@ -55,7 +55,7 @@ int main(int argc, char *argv[])
     #include "setRoots.H"
     #include "createTimeExtruded.H"
 
-    if (args.options().found("sourceCase") == args.options().found("surface"))
+    if (args.optionFound("sourceCase") == args.optionFound("surface"))
     {
         FatalErrorIn(args.executable())
             << "Specify either -sourceCase and -sourcePatch"
@@ -83,12 +83,12 @@ int main(int argc, char *argv[])
         )
     );
 
-    if (args.options().found("sourceCase"))
+    if (args.optionFound("sourceCase"))
     {
-        fileName sourceCasePath(args.options()["sourceCase"]);
+        fileName sourceCasePath(args.option("sourceCase"));
         fileName sourceRootDir = sourceCasePath.path();
         fileName sourceCaseDir = sourceCasePath.name();
-        word patchName(args.options()["sourcePatch"]);
+        word patchName(args.option("sourcePatch"));
 
         Info<< "Extruding patch " << patchName
             << " on mesh " << sourceCasePath << nl
@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
     else
     {
         // Read from surface
-        fileName surfName(args.options()["surface"]);
+        fileName surfName(args.option("surface"));
 
         Info<< "Extruding surfaceMesh read from file " << surfName << nl
             << endl;
@@ -250,7 +250,7 @@ int main(int argc, char *argv[])
     // Merging front and back patch faces
     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-    if (args.options().found("mergeFaces"))
+    if (args.optionFound("mergeFaces"))
     {
         Info<< "Assuming full 360 degree axisymmetric case;"
             << " stitching faces on patches "
diff --git a/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C b/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C
index 52e0f2ae56ae8c0796890da6c7c17181c7500db6..341fc4eab67a8bb5b11134a72688d402aa9f9c00 100644
--- a/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C
+++ b/applications/utilities/mesh/manipulation/attachMesh/attachMesh.C
@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
 #   include "createPolyMesh.H"
     const word oldInstance = mesh.pointsInstance();
 
-    bool overwrite = args.options().found("overwrite");
+    bool overwrite = args.optionFound("overwrite");
 
     if (!overwrite)
     {
diff --git a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C
index 96a7ee5197381c694c0a084aa8d5dc4c6aca2a0e..758592590c4f632b8a09a0a8aba39c8bd816fdde 100644
--- a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C
+++ b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C
@@ -91,7 +91,7 @@ int main(int argc, char *argv[])
     boundaryMesh bMesh;
 
     scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
-    bool overwrite = args.options().found("overwrite");
+    bool overwrite = args.optionFound("overwrite");
 
     scalar minCos = Foam::cos(featureAngle * mathematicalConstant::pi/180.0);
 
diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C
index d226008f5cd47b64772426b6ee2272c6a9e0a68c..2a589c1643dc95f63afc26e85223fa1283105a77 100644
--- a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C
+++ b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C
@@ -58,9 +58,9 @@ int main(int argc, char *argv[])
     instantList timeDirs = timeSelector::select0(runTime, args);
 #   include "createNamedPolyMesh.H"
 
-    const bool noTopology  = args.options().found("noTopology");
-    const bool allGeometry = args.options().found("allGeometry");
-    const bool allTopology = args.options().found("allTopology");
+    const bool noTopology  = args.optionFound("noTopology");
+    const bool allGeometry = args.optionFound("allGeometry");
+    const bool allTopology = args.optionFound("allTopology");
 
     forAll(timeDirs, timeI)
     {
diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C
index ece5f4dde6206fdfdb3bbf8ba5d8e02110916ea7..1fb8cc64efe26da5a52ac4f31de7a293d6d7274f 100644
--- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C
+++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C
@@ -93,11 +93,11 @@ int main(int argc, char *argv[])
 
 
     // Additional patches
-    if (args.options().found("additionalPatches"))
+    if (args.optionFound("additionalPatches"))
     {
         const wordList patchNames
         (
-            IStringStream(args.options()["additionalPatches"])()
+            args.optionLookup("additionalPatches")()
         );
 
         newPatches.reserve(patchNames.size() + 1);
@@ -120,7 +120,7 @@ int main(int argc, char *argv[])
     }
 
 
-    bool overwrite = args.options().found("overwrite");
+    bool overwrite = args.optionFound("overwrite");
 
 
 
diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C
index 7e0443a614666c63e1f13aa4766737cdc62757a8..3c799ca5a4b0a66d6017f956d53bdade480b7c0b 100644
--- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C
+++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C
@@ -539,7 +539,7 @@ int main(int argc, char *argv[])
 #   include "createTime.H"
     runTime.functionObjects().off();
 
-    const bool overwrite = args.options().found("overwrite");
+    const bool overwrite = args.optionFound("overwrite");
 
     Info<< "Reading createPatchDict." << nl << endl;
 
diff --git a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C
index 7b64177da576620e81160feeed77606f5a2b0dc6..f438a1f9637537c09dffbed428cc84d341494fbd 100644
--- a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C
+++ b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C
@@ -59,11 +59,10 @@ int main(int argc, char *argv[])
 
     pointField zeroPoints(mesh.points());
 
-    runTime.setTime(Times[0], 0);
-
-    for (int i = 1; i<Times.size(); i++)
+    // skip "constant" time
+    for (label timeI = 1; timeI < Times.size(); ++timeI)
     {
-        runTime.setTime(Times[i], i);
+        runTime.setTime(Times[timeI], timeI);
 
         Info<< "Time = " << runTime.timeName() << endl;
 
diff --git a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C
index f883c3138b31d87e6898a067d8375f9429b0a1b5..9d826194149f2f87639781d63780dd88a6ac9910 100644
--- a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C
+++ b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C
@@ -231,9 +231,9 @@ int main(int argc, char *argv[])
 #   include "createMesh.H"
     const word oldInstance = mesh.pointsInstance();
 
-    bool split = args.options().found("split");
-    bool overwrite = args.options().found("overwrite");
-    bool detectOnly = args.options().found("detectOnly");
+    bool split      = args.optionFound("split");
+    bool overwrite  = args.optionFound("overwrite");
+    bool detectOnly = args.optionFound("detectOnly");
 
     // Collect all boundary faces
     labelList boundaryFaces(mesh.nFaces() - mesh.nInternalFaces());
diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C
index 7636801b51ea74524ea301ca9fb2374f9ebc2e1b..5760d48aaf898a1a1b02381de9ee1674ac25f041 100644
--- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C
+++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C
@@ -309,8 +309,8 @@ int main(int argc, char *argv[])
     // Read/construct control dictionary
     //
 
-    bool readDict = args.options().found("dict");
-    bool overwrite = args.options().found("overwrite");
+    bool readDict = args.optionFound("dict");
+    bool overwrite = args.optionFound("overwrite");
 
     // List of cells to refine
     labelList refCells;
diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
index b066936f83a5122136cab69fe7f770498fd303ac..bdc60d724b4af233ec85b7048d659c6cbe4aaac0 100644
--- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
+++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C
@@ -386,8 +386,7 @@ int main(int argc, char *argv[])
 #   include "createMesh.H"
     const word oldInstance = mesh.pointsInstance();
 
-    const bool blockOrder = args.options().found("blockOrder");
-
+    const bool blockOrder = args.optionFound("blockOrder");
     if (blockOrder)
     {
         Info<< "Ordering cells into regions (using decomposition);"
@@ -395,15 +394,14 @@ int main(int argc, char *argv[])
             << endl;
     }
 
-    const bool orderPoints = args.options().found("orderPoints");
-
+    const bool orderPoints = args.optionFound("orderPoints");
     if (orderPoints)
     {
         Info<< "Ordering points into internal and boundary points." << nl
             << endl;
     }
 
-    const bool writeMaps = args.options().found("writeMaps");
+    const bool writeMaps = args.optionFound("writeMaps");
 
     if (writeMaps)
     {
@@ -411,7 +409,7 @@ int main(int argc, char *argv[])
             << endl;
     }
 
-    bool overwrite = args.options().found("overwrite");
+    bool overwrite = args.optionFound("overwrite");
 
     label band = getBand(mesh.faceOwner(), mesh.faceNeighbour());
 
diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C
index ff6d576b0abb121cdc58bd7b4cd730e0431d9052..d79d516806e040de45f70483eec4cdd195bacd04 100644
--- a/applications/utilities/mesh/manipulation/setSet/setSet.C
+++ b/applications/utilities/mesh/manipulation/setSet/setSet.C
@@ -591,24 +591,10 @@ commandStatus parseType
     }
     else if (setType == "time")
     {
-        scalar time = readScalar(is);
-
+        scalar requestedTime = readScalar(is);
         instantList Times = runTime.times();
 
-        int nearestIndex = -1;
-        scalar nearestDiff = Foam::GREAT;
-
-        forAll(Times, timeIndex)
-        {
-            if (Times[timeIndex].name() == "constant") continue;
-
-            scalar diff = fabs(Times[timeIndex].value() - time);
-            if (diff < nearestDiff)
-            {
-                nearestDiff = diff;
-                nearestIndex = timeIndex;
-            }
-        }
+        label nearestIndex = Time::findClosestTimeIndex(Times, requestedTime);
 
         Pout<< "Changing time from " << runTime.timeName()
             << " to " << Times[nearestIndex].name()
@@ -646,7 +632,8 @@ commandStatus parseType
             }
             default:
             {
-                FatalErrorIn("parseType") << "Illegal mesh update state "
+                FatalErrorIn("parseType")
+                    << "Illegal mesh update state "
                     << stat  << abort(FatalError);
                 break;
             }
@@ -723,7 +710,7 @@ int main(int argc, char *argv[])
 #   include "setRootCase.H"
 #   include "createTime.H"
 
-    bool writeVTK = !args.options().found("noVTK");
+    bool writeVTK = !args.optionFound("noVTK");
 
     // Get times list
     instantList Times = runTime.times();
@@ -740,13 +727,13 @@ int main(int argc, char *argv[])
 
     std::ifstream* fileStreamPtr(NULL);
 
-    if (args.options().found("batch"))
+    if (args.optionFound("batch"))
     {
-        fileName batchFile(args.options()["batch"]);
+        fileName batchFile(args.option("batch"));
 
         Pout<< "Reading commands from file " << batchFile << endl;
 
-        // we also cannot handle .gz files
+        // we cannot handle .gz files
         if (!isFile(batchFile, false))
         {
             FatalErrorIn(args.executable())
@@ -864,7 +851,7 @@ int main(int argc, char *argv[])
         delete fileStreamPtr;
     }
 
-    Pout << nl << "End" << endl;
+    Pout<< "\nEnd" << endl;
 
     return 0;
 }
diff --git a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C
index ac32c1ccc9ad54a3bf20c043dc698d363080b643..dfd7262fd17ba65a287bd041289dbcc95475c7df 100644
--- a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C
+++ b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C
@@ -64,8 +64,7 @@ int main(int argc, char *argv[])
 #   include "setRootCase.H"
 #   include "createTime.H"
 
-
-    bool noFlipMap = args.options().found("noFlipMap");
+    bool noFlipMap = args.optionFound("noFlipMap");
 
     // Get times list
     instantList Times = runTime.times();
@@ -73,9 +72,8 @@ int main(int argc, char *argv[])
     label startTime = Times.size()-1;
     label endTime = Times.size();
 
+    // check -time and -latestTime options
 #   include "checkTimeOption.H"
-#   include "checkLatestTimeOption.H"
-
 
     runTime.setTime(Times[startTime], startTime);
 
diff --git a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C
index b865472dadf7c92bfc2a6d340d256914913c6494..65e4d33237df440e9b72236179b6d617645ca7db 100644
--- a/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C
+++ b/applications/utilities/mesh/manipulation/splitMesh/splitMesh.C
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
     word setName(args.additionalArgs()[0]);
     word masterPatch(args.additionalArgs()[1]);
     word slavePatch(args.additionalArgs()[2]);
-    bool overwrite = args.options().found("overwrite");
+    bool overwrite = args.optionFound("overwrite");
 
     // List of faces to split
     faceSet facesSet(mesh, setName);
diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
index e71a5f11c0b2ff259f3d3f6b0f997df0efd29f88..72c1fbd3500019a316f74a2be861bdcf0e2581c7 100644
--- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
+++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C
@@ -1239,20 +1239,20 @@ int main(int argc, char *argv[])
     const word oldInstance = mesh.pointsInstance();
 
     word blockedFacesName;
-    if (args.options().found("blockedFaces"))
+    if (args.optionFound("blockedFaces"))
     {
-        blockedFacesName = args.options()["blockedFaces"];
+        blockedFacesName = args.option("blockedFaces");
         Info<< "Reading blocked internal faces from faceSet "
             << blockedFacesName << nl << endl;
     }
 
-    bool makeCellZones = args.options().found("makeCellZones");
-    bool largestOnly = args.options().found("largestOnly");
-    bool insidePoint = args.options().found("insidePoint");
-    bool useCellZones = args.options().found("cellZones");
-    bool overwrite = args.options().found("overwrite");
-    bool detectOnly = args.options().found("detectOnly");
-    bool sloppyCellZones = args.options().found("sloppyCellZones");
+    bool makeCellZones   = args.optionFound("makeCellZones");
+    bool largestOnly     = args.optionFound("largestOnly");
+    bool insidePoint     = args.optionFound("insidePoint");
+    bool useCellZones    = args.optionFound("cellZones");
+    bool overwrite       = args.optionFound("overwrite");
+    bool detectOnly      = args.optionFound("detectOnly");
+    bool sloppyCellZones = args.optionFound("sloppyCellZones");
 
     if (insidePoint && largestOnly)
     {
@@ -1771,7 +1771,7 @@ int main(int argc, char *argv[])
 
         if (insidePoint)
         {
-            point insidePoint(IStringStream(args.options()["insidePoint"])());
+            point insidePoint(args.optionLookup("insidePoint")());
 
             label regionI = -1;
 
diff --git a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C
index 2a9784980ac2ab9b4d4f193b3e27f99f06519827..e3536a5ad05862bd0370cf9e000992673797d944 100644
--- a/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C
+++ b/applications/utilities/mesh/manipulation/stitchMesh/stitchMesh.C
@@ -142,9 +142,9 @@ int main(int argc, char *argv[])
     word masterPatchName(args.additionalArgs()[0]);
     word slavePatchName(args.additionalArgs()[1]);
 
-    bool partialCover = args.options().found("partial");
-    bool perfectCover = args.options().found("perfect");
-    bool overwrite = args.options().found("overwrite");
+    bool partialCover = args.optionFound("partial");
+    bool perfectCover = args.optionFound("perfect");
+    bool overwrite    = args.optionFound("overwrite");
 
     if (partialCover && perfectCover)
     {
diff --git a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C
index 56b48a2dd2a9ce81259605e685c8c29f2f71d34b..338c8dbcb1c6ffd1da88073613122d3d85b1a39d 100644
--- a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C
+++ b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C
@@ -162,7 +162,7 @@ int main(int argc, char *argv[])
     const word oldInstance = mesh.pointsInstance();
 
     word setName(args.additionalArgs()[0]);
-    bool overwrite = args.options().found("overwrite");
+    bool overwrite = args.optionFound("overwrite");
 
 
     Info<< "Reading cell set from " << setName << endl << endl;
@@ -172,9 +172,9 @@ int main(int argc, char *argv[])
 
     label patchI = -1;
 
-    if (args.options().found("patch"))
+    if (args.optionFound("patch"))
     {
-        word patchName(args.options()["patch"]);
+        word patchName(args.option("patch"));
 
         patchI = mesh.boundaryMesh().findPatchID(patchName);
 
diff --git a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C
index bc2b017a2cbf393ee677afdbf3a3054d89789923..630243e2ef2b465254108bb18354a59a65633281 100644
--- a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C
+++ b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C
@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
     argList::validOptions.insert("yawPitchRoll", "(yaw pitch roll)");
     argList::validOptions.insert("rotateFields", "");
     argList::validOptions.insert("scale", "vector");
- 
+
 #   include "setRootCase.H"
 #   include "createTime.H"
 
@@ -171,18 +171,18 @@ int main(int argc, char *argv[])
             << exit(FatalError);
     }
 
-    if (args.options().found("translate"))
+    if (args.optionFound("translate"))
     {
-        vector transVector(IStringStream(args.options()["translate"])());
+        vector transVector(args.optionLookup("translate")());
 
         Info<< "Translating points by " << transVector << endl;
 
         points += transVector;
     }
 
-    if (args.options().found("rotate"))
+    if (args.optionFound("rotate"))
     {
-        Pair<vector> n1n2(IStringStream(args.options()["rotate"])());
+        Pair<vector> n1n2(args.optionLookup("rotate")());
         n1n2[0] /= mag(n1n2[0]);
         n1n2[1] /= mag(n1n2[1]);
         tensor T = rotationTensor(n1n2[0], n1n2[1]);
@@ -191,14 +191,14 @@ int main(int argc, char *argv[])
 
         points = transform(T, points);
 
-        if (args.options().found("rotateFields"))
+        if (args.optionFound("rotateFields"))
         {
             rotateFields(runTime, T);
         }
     }
-    else if (args.options().found("rollPitchYaw"))
+    else if (args.optionFound("rollPitchYaw"))
     {
-        vector v(IStringStream(args.options()["rollPitchYaw"])());
+        vector v(args.optionLookup("rollPitchYaw")());
 
         Info<< "Rotating points by" << nl
             << "    roll  " << v.x() << nl
@@ -214,14 +214,14 @@ int main(int argc, char *argv[])
         Info<< "Rotating points by quaternion " << R << endl;
         points = transform(R, points);
 
-        if (args.options().found("rotateFields"))
+        if (args.optionFound("rotateFields"))
         {
             rotateFields(runTime, R.R());
         }
     }
-    else if (args.options().found("yawPitchRoll"))
+    else if (args.optionFound("yawPitchRoll"))
     {
-        vector v(IStringStream(args.options()["yawPitchRoll"])());
+        vector v(args.optionLookup("yawPitchRoll")());
 
         Info<< "Rotating points by" << nl
             << "    yaw   " << v.x() << nl
@@ -243,15 +243,15 @@ int main(int argc, char *argv[])
         Info<< "Rotating points by quaternion " << R << endl;
         points = transform(R, points);
 
-        if (args.options().found("rotateFields"))
+        if (args.optionFound("rotateFields"))
         {
             rotateFields(runTime, R.R());
         }
     }
 
-    if (args.options().found("scale"))
+    if (args.optionFound("scale"))
     {
-        vector scaleVector(IStringStream(args.options()["scale"])());
+        vector scaleVector(args.optionLookup("scale")());
 
         Info<< "Scaling points by " << scaleVector << endl;
 
diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C
index 6854ba0b8d53a0d08bce360e3cc1c2928267d6f2..d4eb9c3b63af51002d3cf4c136a9416c8bf01a5c 100644
--- a/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C
+++ b/applications/utilities/miscellaneous/foamDebugSwitches/foamDebugSwitches.C
@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
     wordList currInfo(debug::infoSwitches().toc());
     wordList currOpt(debug::optimisationSwitches().toc());
 
-    if (args.options().found("old") || args.options().found("new"))
+    if (args.optionFound("old") || args.optionFound("new"))
     {
         dictionary controlDict(IFstream(findEtcFile("controlDict", true))());
 
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
         //  1. run without any options (get complete list)
         //  2. comment out DebugSwitches, run again with -new to find new ones
         //     and do a diff
-        if (args.options().found("old"))
+        if (args.optionFound("old"))
         {
             IOobject::writeDivider(Info);
 
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
         }
 
         // list new switches
-        if (args.options().found("new"))
+        if (args.optionFound("new"))
         {
             IOobject::writeDivider(Info);
 
diff --git a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C
index 3de53a2f22659e51012e2d005fe529b50408e3bd..b55e5b97013886395b11e200bc4c7661490d71ce 100644
--- a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C
+++ b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C
@@ -49,9 +49,9 @@ int main(int argc, char *argv[])
 
     Info<< endl;
 
-    if (args.options().found("times"))
+    if (args.optionFound("times"))
     {
-        instantList times 
+        instantList times
         (
             Foam::Time::findTimes(args.rootPath()/args.caseName())
         );
@@ -62,11 +62,11 @@ int main(int argc, char *argv[])
         }
     }
 
-    if (args.options().found("dictionary"))
+    if (args.optionFound("dictionary"))
     {
         fileName dictFileName
         (
-            args.rootPath()/args.caseName()/args.options()["dictionary"]
+            args.rootPath()/args.caseName()/args.option("dictionary")
         );
 
         IFstream dictFile(dictFileName);
@@ -75,11 +75,7 @@ int main(int argc, char *argv[])
         {
             dictionary dict(dictFile);
 
-            if
-            (
-                args.options().found("keywords")
-             && !args.options().found("entry")
-            )
+            if (args.optionFound("keywords") && !args.optionFound("entry"))
             {
                 for
                 (
@@ -91,11 +87,11 @@ int main(int argc, char *argv[])
                     Info<< iter().keyword() << endl;
                 }
             }
-            else if (args.options().found("entry"))
+            else if (args.optionFound("entry"))
             {
                 wordList entryNames
                 (
-                    fileName(args.options()["entry"]).components(':')
+                    fileName(args.option("entry")).components(':')
                 );
 
                 if (dict.found(entryNames[0]))
@@ -122,20 +118,20 @@ int main(int argc, char *argv[])
                         {
                             FatalErrorIn(args.executable())
                                 << "Cannot find sub-entry " << entryNames[i]
-                                << " in entry " << args.options()["entry"]
+                                << " in entry " << args.option("entry")
                                 << " in dictionary " << dictFileName;
                             FatalError.exit(3);
                         }
                     }
-                    
-                    if (args.options().found("keywords"))
+
+                    if (args.optionFound("keywords"))
                     {
                         /*
                         if (ent[1] != token::BEGIN_BLOCK)
                         {
                             FatalErrorIn(args.executable())
                                 << "Cannot find entry "
-                                << args.options()["entry"]
+                                << args.option("entry")
                                 << " in dictionary " << dictFileName
                                 << " is not a sub-dictionary";
                             FatalError.exit(4);
diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
index fef8c71aa1111d471763a65e09ec273d49f4f723..65dd679ecd73fc3bd6688aecb0964566465bf042 100644
--- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
+++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C
@@ -99,20 +99,20 @@ int main(int argc, char *argv[])
     word regionName = fvMesh::defaultRegion;
     word regionDir = word::null;
 
-    if (args.options().found("region"))
+    if (args.optionFound("region"))
     {
-        regionName = args.options()["region"];
+        regionName = args.option("region");
         regionDir = regionName;
         Info<< "Decomposing mesh " << regionName << nl << endl;
     }
 
 
-    bool writeCellDist(args.options().found("cellDist"));
-    bool copyUniform(args.options().found("copyUniform"));
-    bool decomposeFieldsOnly(args.options().found("fields"));
-    bool filterPatches(args.options().found("filterPatches"));
-    bool forceOverwrite(args.options().found("force"));
-    bool ifRequiredDecomposition(args.options().found("ifRequired"));
+    bool writeCellDist           = args.optionFound("cellDist");
+    bool copyUniform             = args.optionFound("copyUniform");
+    bool decomposeFieldsOnly     = args.optionFound("fields");
+    bool filterPatches           = args.optionFound("filterPatches");
+    bool forceOverwrite          = args.optionFound("force");
+    bool ifRequiredDecomposition = args.optionFound("ifRequired");
 
 #   include "createTime.H"
 
diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C
index 1e3ed2b9bfb779780f349a3e59d13eab0689aa04..dd014c299fa1b27cc0e2ab784b12eb8442a2cd3d 100644
--- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C
+++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C
@@ -57,12 +57,12 @@ int main(int argc, char *argv[])
 #   include "createTime.H"
 
     HashSet<word> selectedFields;
-    if (args.options().found("fields"))
+    if (args.optionFound("fields"))
     {
-        IStringStream(args.options()["fields"])() >> selectedFields;
+        args.optionLookup("fields")() >> selectedFields;
     }
 
-    bool noLagrangian = args.options().found("noLagrangian");
+    bool noLagrangian = args.optionFound("noLagrangian");
 
     // determine the processor count directly
     label nProcs = 0;
diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C
index 627f2b15b48a26984c4ced5ec54ff1ece41a4b34..dc28db70971ab9aa66e93d398361971a6927dfe2 100644
--- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C
+++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C
@@ -306,18 +306,16 @@ int main(int argc, char *argv[])
 
     word regionName = polyMesh::defaultRegion;
     fileName regionPrefix = "";
-    if (args.options().found("region"))
+    if (args.optionFound("region"))
     {
-        regionName = args.options()["region"];
+        regionName = args.option("region");
         regionPrefix = regionName;
         Info<< "Operating on region " << regionName << nl << endl;
     }
 
     scalar mergeTol = defaultMergeTol;
-    if (args.options().found("mergeTol"))
-    {
-        mergeTol = readScalar(IStringStream(args.options()["mergeTol"])());
-    }
+    args.optionReadIfPresent("mergeTol", mergeTol);
+
     scalar writeTol = Foam::pow(10.0, -scalar(IOstream::defaultPrecision()));
 
     Info<< "Merge tolerance : " << mergeTol << nl
@@ -337,7 +335,7 @@ int main(int argc, char *argv[])
     }
 
 
-    const bool fullMatch = args.options().found("fullMatch");
+    const bool fullMatch = args.optionFound("fullMatch");
 
     if (fullMatch)
     {
diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C b/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C
index c46a41b2738795d7335106179fdd9dd9c343b9e9..c0859573e0d706fc2c996f66ec00aad434a49d9b 100644
--- a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C
+++ b/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C
@@ -240,10 +240,7 @@ scalar getMergeDistance
 )
 {
     scalar mergeTol = defaultMergeTol;
-    if (args.options().found("mergeTol"))
-    {
-        mergeTol = readScalar(IStringStream(args.options()["mergeTol"])());
-    }
+    args.optionReadIfPresent("mergeTol", mergeTol);
 
     scalar writeTol =
         Foam::pow(scalar(10.0), -scalar(IOstream::defaultPrecision()));
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H
index 59be3c5dc9ffda60e2ceaae872a7054b797b68f3..1144833a0136070251c67aec0d4f5ca2eec118f2 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H
@@ -1,18 +1,21 @@
-for (int n1=startTime; n1<endTime; n1++)
+// ignore special fields or fields that we don't handle
+//
+bool variableGood = true;
+for (label n1=startTime; n1<endTime && variableGood; ++n1)
 {
+    // ignore _0 fields
     if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")
     {
         variableGood = false;
-        break;
     }
-
-    IOobject fieldObjectHeader
-    (
-        fieldName,
-        Times[n1].name(),
-        mesh,
-        IOobject::NO_READ
-    );
-
-    variableGood = variableGood && fieldObjectHeader.headerOk();
+    else
+    {
+        variableGood = IOobject
+        (
+            fieldName,
+            Times[n1].name(),
+            mesh,
+            IOobject::NO_READ
+        ).headerOk();
+    }
 }
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H
index e6e46c8f868adf8e382f53d6c36228051f44fcf0..123036f63afe9d1a30c205fce0efc311125d6785 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H
@@ -1,19 +1,19 @@
-bool meshMoving = true;
+// check for "points" in all of the result directories
 
+bool meshMoving = true;
 if (Times.size() > 2)
 {
-   for(label n2=2; n2<Times.size(); n2++)
-   {
-       IOobject tmpPoints
-       (
-           "points",
-           Times[n2].name(),
-           polyMesh::meshSubDir,
-           mesh,
-           IOobject::NO_READ
-       );
-       meshMoving = meshMoving && tmpPoints.headerOk();
-   }
+    for (label n1=2; n1<Times.size() && meshMoving; ++n1)
+    {
+        meshMoving = IOobject
+        (
+            "points",
+            Times[n1].name(),
+            polyMesh::meshSubDir,
+            mesh,
+            IOobject::NO_READ
+        ).headerOk();
+    }
 }
 else
 {
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseHeader.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseHeader.H
deleted file mode 100644
index cc81cb465952ed52026b274d56375de627f45134..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseHeader.H
+++ /dev/null
@@ -1,5 +0,0 @@
-if (Pstream::master())
-{
-    ensightCaseFile << "FORMAT" << nl;
-    ensightCaseFile << "type: ensight gold" << nl << nl;
-}
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C
index 980a3c61536eb12601d6b541c187409108722878..64452a05f70c00bffbfc7ab792e545a4cda369a7 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightField.C
@@ -275,8 +275,8 @@ template<class Type>
 bool writePatchField
 (
     const Foam::Field<Type>& pf,
-    const Foam::label patchi,
-    const Foam::label ensightPatchi,
+    const Foam::label patchI,
+    const Foam::label ensightPatchI,
     const Foam::faceSets& boundaryFaceSet,
     const Foam::ensightMesh::nFacePrimitives& nfp,
     const Foam::labelList& patchProcessors,
@@ -289,7 +289,7 @@ bool writePatchField
         {
             ensightFile
                 << "part" << nl
-                << setw(10) << ensightPatchi << nl;
+                << setw(10) << ensightPatchI << nl;
         }
 
         writeAllFaceData
@@ -335,8 +335,8 @@ template<class Type>
 bool writePatchFieldBinary
 (
     const Foam::Field<Type>& pf,
-    const Foam::label patchi,
-    const Foam::label ensightPatchi,
+    const Foam::label patchI,
+    const Foam::label ensightPatchI,
     const Foam::faceSets& boundaryFaceSet,
     const Foam::ensightMesh::nFacePrimitives& nfp,
     const Foam::labelList& patchProcessors,
@@ -348,7 +348,7 @@ bool writePatchFieldBinary
         if (Pstream::master())
         {
             writeEnsDataBinary("part",ensightFile);
-            writeEnsDataBinary(ensightPatchi,ensightFile);
+            writeEnsDataBinary(ensightPatchI,ensightFile);
         }
 
         writeAllFaceDataBinary
@@ -411,14 +411,14 @@ void writePatchField
     const HashTable<ensightMesh::nFacePrimitives>&
         nPatchPrims = eMesh.nPatchPrims();
 
-    label patchi = -1;
+    label patchI = -1;
 
     if (patchIndices.found(patchName))
     {
-        patchi = patchIndices.find(patchName)();
+        patchI = patchIndices.find(patchName)();
     }
 
-    label ensightPatchi = 2;
+    label ensightPatchI = eMesh.patchPartOffset();
 
     for
     (
@@ -429,7 +429,7 @@ void writePatchField
     )
     {
         if (iter.key() == patchName) break;
-        ensightPatchi++;
+        ensightPatchI++;
     }
 
 
@@ -472,14 +472,14 @@ void writePatchField
         ensightFile << pTraits<Type>::typeName << nl;
     }
 
-    if (patchi >= 0)
+    if (patchI >= 0)
     {
         writePatchField
         (
             pf,
-            patchi,
-            ensightPatchi,
-            boundaryFaceSets[patchi],
+            patchI,
+            ensightPatchI,
+            boundaryFaceSets[patchI],
             nPatchPrims.find(patchName)(),
             patchProcessors,
             ensightFile
@@ -493,7 +493,7 @@ void writePatchField
         (
             Field<Type>(),
             -1,
-            ensightPatchi,
+            ensightPatchI,
             nullFaceSets,
             nPatchPrims.find(patchName)(),
             patchProcessors,
@@ -621,7 +621,7 @@ void ensightFieldAscii
         writeAllData("nfaced", vf, polys, meshCellSets.nPolys, ensightFile);
     }
 
-    label ensightPatchi = 2;
+    label ensightPatchI = eMesh.patchPartOffset();
 
     for
     (
@@ -637,23 +637,23 @@ void ensightFieldAscii
         {
             if (patchIndices.found(patchName))
             {
-                label patchi = patchIndices.find(patchName)();
+                label patchI = patchIndices.find(patchName)();
 
                 if
                 (
                     writePatchField
                     (
-                        vf.boundaryField()[patchi],
-                        patchi,
-                        ensightPatchi,
-                        boundaryFaceSets[patchi],
+                        vf.boundaryField()[patchI],
+                        patchI,
+                        ensightPatchI,
+                        boundaryFaceSets[patchI],
                         nPatchPrims.find(patchName)(),
                         patchProcessors,
                         ensightFile
                     )
                 )
                 {
-                    ensightPatchi++;
+                    ensightPatchI++;
                 }
 
             }
@@ -667,7 +667,7 @@ void ensightFieldAscii
                     (
                         Field<Type>(),
                         -1,
-                        ensightPatchi,
+                        ensightPatchI,
                         nullFaceSet,
                         nPatchPrims.find(patchName)(),
                         patchProcessors,
@@ -675,7 +675,7 @@ void ensightFieldAscii
                     )
                 )
                 {
-                    ensightPatchi++;
+                    ensightPatchI++;
                 }
             }
         }
@@ -793,7 +793,7 @@ void ensightFieldBinary
         writeAllDataBinary("nfaced", vf, polys, meshCellSets.nPolys, ensightFile);
     }
 
-    label ensightPatchi = 2;
+    label ensightPatchI = eMesh.patchPartOffset();
 
     for
     (
@@ -809,23 +809,23 @@ void ensightFieldBinary
         {
             if (patchIndices.found(patchName))
             {
-                label patchi = patchIndices.find(patchName)();
+                label patchI = patchIndices.find(patchName)();
 
                 if
                 (
                     writePatchFieldBinary
                     (
-                        vf.boundaryField()[patchi],
-                        patchi,
-                        ensightPatchi,
-                        boundaryFaceSets[patchi],
+                        vf.boundaryField()[patchI],
+                        patchI,
+                        ensightPatchI,
+                        boundaryFaceSets[patchI],
                         nPatchPrims.find(patchName)(),
                         patchProcessors,
                         ensightFile
                     )
                 )
                 {
-                    ensightPatchi++;
+                    ensightPatchI++;
                 }
 
             }
@@ -839,7 +839,7 @@ void ensightFieldBinary
                     (
                         Field<Type>(),
                         -1,
-                        ensightPatchi,
+                        ensightPatchI,
                         nullFaceSet,
                         nPatchPrims.find(patchName)(),
                         patchProcessors,
@@ -847,7 +847,7 @@ void ensightFieldBinary
                     )
                 )
                 {
-                    ensightPatchi++;
+                    ensightPatchI++;
                 }
             }
         }
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C
index b69a9264c124845c74669733762e95e45592660c..079145a0c567597811b54295430bf454d350c24e 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C
@@ -89,8 +89,9 @@ Foam::ensightMesh::ensightMesh
     const bool binary
 )
 :
-    binary_(binary),
     mesh_(mesh),
+    binary_(binary),
+    patchPartOffset_(2),
     meshCellSets_(mesh_.nCells()),
     boundaryFaceSets_(mesh_.boundary().size()),
     allPatchNames_(0),
@@ -98,101 +99,109 @@ Foam::ensightMesh::ensightMesh
     patchNames_(0),
     nPatchPrims_(0)
 {
-    forAll (mesh_.boundaryMesh(), patchi)
+    const cellShapeList& cellShapes = mesh.cellShapes();
+
+    const cellModel& tet = *(cellModeller::lookup("tet"));
+    const cellModel& pyr = *(cellModeller::lookup("pyr"));
+    const cellModel& prism = *(cellModeller::lookup("prism"));
+    const cellModel& wedge = *(cellModeller::lookup("wedge"));
+    const cellModel& hex = *(cellModeller::lookup("hex"));
+
+    if (!args.optionFound("noPatches"))
     {
-        if
-        (
-            typeid(mesh_.boundaryMesh()[patchi])
-         != typeid(processorPolyPatch)
-        )
+        forAll (mesh_.boundaryMesh(), patchI)
         {
-            if (!allPatchNames_.found(mesh_.boundaryMesh()[patchi].name()))
+            if
+            (
+                typeid(mesh_.boundaryMesh()[patchI])
+             != typeid(processorPolyPatch)
+            )
             {
-                allPatchNames_.insert
-                (
-                    mesh_.boundaryMesh()[patchi].name(),
-                    labelList(1, Pstream::myProcNo())
-                );
+                if (!allPatchNames_.found(mesh_.boundaryMesh()[patchI].name()))
+                {
+                    allPatchNames_.insert
+                    (
+                        mesh_.boundaryMesh()[patchI].name(),
+                        labelList(1, Pstream::myProcNo())
+                    );
 
-                patchIndices_.insert
-                (
-                    mesh_.boundaryMesh()[patchi].name(),
-                    patchi
-                );
+                    patchIndices_.insert
+                    (
+                        mesh_.boundaryMesh()[patchI].name(),
+                        patchI
+                    );
+                }
             }
         }
-    }
 
-    combineReduce(allPatchNames_, concatPatchNames());
-
-    if (args.options().found("patches"))
-    {
-        wordList patchNameList(IStringStream(args.options()["patches"])());
+        combineReduce(allPatchNames_, concatPatchNames());
 
-        if (patchNameList.empty())
+        if (args.optionFound("patches"))
         {
-            patchNameList = allPatchNames_.toc();
-        }
+            wordList patchNameList(args.optionLookup("patches")());
 
-        forAll (patchNameList, i)
-        {
-            patchNames_.insert(patchNameList[i]);
+            if (patchNameList.empty())
+            {
+                patchNameList = allPatchNames_.toc();
+            }
+
+            forAll (patchNameList, i)
+            {
+                patchNames_.insert(patchNameList[i]);
+            }
         }
     }
 
-    const cellShapeList& cellShapes = mesh.cellShapes();
-
-    const cellModel& tet = *(cellModeller::lookup("tet"));
-    const cellModel& pyr = *(cellModeller::lookup("pyr"));
-    const cellModel& prism = *(cellModeller::lookup("prism"));
-    const cellModel& wedge = *(cellModeller::lookup("wedge"));
-    const cellModel& hex = *(cellModeller::lookup("hex"));
-
-    labelList& tets = meshCellSets_.tets;
-    labelList& pyrs = meshCellSets_.pyrs;
-    labelList& prisms = meshCellSets_.prisms;
-    labelList& wedges = meshCellSets_.wedges;
-    labelList& hexes = meshCellSets_.hexes;
-    labelList& polys = meshCellSets_.polys;
-
-    // Count the shapes
-    label nTets = 0;
-    label nPyrs = 0;
-    label nPrisms = 0;
-    label nWedges = 0;
-    label nHexes = 0;
-    label nPolys = 0;
-
-    if (patchNames_.empty())
+    if (patchNames_.size())
     {
-        forAll(cellShapes, celli)
+        // no internalMesh
+        patchPartOffset_ = 1;
+    }
+    else
+    {
+        // Count the shapes
+        labelList& tets = meshCellSets_.tets;
+        labelList& pyrs = meshCellSets_.pyrs;
+        labelList& prisms = meshCellSets_.prisms;
+        labelList& wedges = meshCellSets_.wedges;
+        labelList& hexes = meshCellSets_.hexes;
+        labelList& polys = meshCellSets_.polys;
+
+        label nTets = 0;
+        label nPyrs = 0;
+        label nPrisms = 0;
+        label nWedges = 0;
+        label nHexes = 0;
+        label nPolys = 0;
+
+        forAll(cellShapes, cellI)
         {
-            const cellShape& cellShape = cellShapes[celli];
+            const cellShape& cellShape = cellShapes[cellI];
             const cellModel& cellModel = cellShape.model();
 
             if (cellModel == tet)
             {
-                tets[nTets++] = celli;
+                tets[nTets++] = cellI;
             }
             else if (cellModel == pyr)
             {
-                pyrs[nPyrs++] = celli;
+                pyrs[nPyrs++] = cellI;
             }
             else if (cellModel == prism)
             {
-                prisms[nPrisms++] = celli;
+                prisms[nPrisms++] = cellI;
             }
             else if (cellModel == wedge)
             {
-                wedges[nWedges++] = celli;
+                wedges[nWedges++] = cellI;
             }
             else if (cellModel == hex)
             {
-                hexes[nHexes++] = celli;
+                hexes[nHexes++] = cellI;
             }
             else
             {
-                polys[nPolys++] = celli;
+                polys[nPolys++] = cellI;
             }
         }
 
@@ -219,49 +228,52 @@ Foam::ensightMesh::ensightMesh
         reduce(meshCellSets_.nPolys, sumOp<label>());
     }
 
-
-    forAll (mesh.boundary(), patchi)
+    if (!args.optionFound("noPatches"))
     {
-        if (mesh.boundary()[patchi].size())
+        forAll (mesh.boundary(), patchI)
         {
-            const polyPatch& p = mesh.boundaryMesh()[patchi];
-
-            labelList& tris = boundaryFaceSets_[patchi].tris;
-            labelList& quads = boundaryFaceSets_[patchi].quads;
-            labelList& polys = boundaryFaceSets_[patchi].polys;
+            if (mesh.boundary()[patchI].size())
+            {
+                const polyPatch& p = mesh.boundaryMesh()[patchI];
 
-            tris.setSize(p.size());
-            quads.setSize(p.size());
-            polys.setSize(p.size());
+                labelList& tris = boundaryFaceSets_[patchI].tris;
+                labelList& quads = boundaryFaceSets_[patchI].quads;
+                labelList& polys = boundaryFaceSets_[patchI].polys;
 
-            label nTris = 0;
-            label nQuads = 0;
-            label nPolys = 0;
+                tris.setSize(p.size());
+                quads.setSize(p.size());
+                polys.setSize(p.size());
 
-            forAll(p, facei)
-            {
-                const face& f = p[facei];
+                label nTris = 0;
+                label nQuads = 0;
+                label nPolys = 0;
 
-                if (f.size() == 3)
+                forAll(p, faceI)
                 {
-                    tris[nTris++] = facei;
-                }
-                else if (f.size() == 4)
-                {
-                    quads[nQuads++] = facei;
-                }
-                else
-                {
-                    polys[nPolys++] = facei;
+                    const face& f = p[faceI];
+
+                    if (f.size() == 3)
+                    {
+                        tris[nTris++] = faceI;
+                    }
+                    else if (f.size() == 4)
+                    {
+                        quads[nQuads++] = faceI;
+                    }
+                    else
+                    {
+                        polys[nPolys++] = faceI;
+                    }
                 }
-            }
 
-            tris.setSize(nTris);
-            quads.setSize(nQuads);
-            polys.setSize(nPolys);
+                tris.setSize(nTris);
+                quads.setSize(nQuads);
+                polys.setSize(nPolys);
+            }
         }
     }
 
+
     forAllConstIter(HashTable<labelList>, allPatchNames_, iter)
     {
         const word& patchName = iter.key();
@@ -271,12 +283,12 @@ Foam::ensightMesh::ensightMesh
         {
             if (patchIndices_.found(patchName))
             {
-                label patchi = patchIndices_.find(patchName)();
+                label patchI = patchIndices_.find(patchName)();
 
-                nfp.nPoints = mesh.boundaryMesh()[patchi].localPoints().size();
-                nfp.nTris = boundaryFaceSets_[patchi].tris.size();
-                nfp.nQuads = boundaryFaceSets_[patchi].quads.size();
-                nfp.nPolys = boundaryFaceSets_[patchi].polys.size();
+                nfp.nPoints = mesh.boundaryMesh()[patchI].localPoints().size();
+                nfp.nTris   = boundaryFaceSets_[patchI].tris.size();
+                nfp.nQuads  = boundaryFaceSets_[patchI].quads.size();
+                nfp.nPolys  = boundaryFaceSets_[patchI].polys.size();
             }
         }
 
@@ -304,9 +316,9 @@ void Foam::ensightMesh::writePoints
     OFstream& ensightGeometryFile
 ) const
 {
-    forAll(pointsComponent, pointi)
+    forAll(pointsComponent, pointI)
     {
-        ensightGeometryFile<< setw(12) << float(pointsComponent[pointi]) << nl;
+        ensightGeometryFile<< setw(12) << float(pointsComponent[pointI]) << nl;
     }
 }
 
@@ -380,9 +392,9 @@ void Foam::ensightMesh::writePrims
     {
         const cellShape& cellPoints = cellShapes[i];
 
-        forAll(cellPoints, pointi)
+        forAll(cellPoints, pointI)
         {
-            ensightGeometryFile<< setw(10) << cellPoints[pointi] + po;
+            ensightGeometryFile<< setw(10) << cellPoints[pointI] + po;
         }
         ensightGeometryFile << nl;
     }
@@ -415,9 +427,9 @@ void Foam::ensightMesh::writePrimsBinary
         {
             const cellShape& cellPoints = cellShapes[i];
 
-            forAll(cellPoints, pointi)
+            forAll(cellPoints, pointI)
             {
-                temp[n] = cellPoints[pointi] + po;
+                temp[n] = cellPoints[pointI] + po;
                 n++;
             }
         }
@@ -457,10 +469,10 @@ void Foam::ensightMesh::writePolys
         {
             const labelList& cf = cellFaces[polys[i]];
 
-            forAll(cf, facei)
+            forAll(cf, faceI)
             {
                 ensightGeometryFile
-                    << setw(10) << faces[cf[facei]].size() << nl;
+                    << setw(10) << faces[cf[faceI]].size() << nl;
             }
         }
 
@@ -468,13 +480,13 @@ void Foam::ensightMesh::writePolys
         {
             const labelList& cf = cellFaces[polys[i]];
 
-            forAll(cf, facei)
+            forAll(cf, faceI)
             {
-                const face& f = faces[cf[facei]];
+                const face& f = faces[cf[faceI]];
 
-                forAll(f, pointi)
+                forAll(f, pointI)
                 {
-                    ensightGeometryFile << setw(10) << f[pointi] + po;
+                    ensightGeometryFile << setw(10) << f[pointI] + po;
                 }
                 ensightGeometryFile << nl;
             }
@@ -513,11 +525,11 @@ void Foam::ensightMesh::writePolysBinary
         {
             const labelList& cf = cellFaces[polys[i]];
 
-            forAll(cf, facei)
+            forAll(cf, faceI)
             {
                 writeEnsDataBinary
                 (
-                    faces[cf[facei]].size(),
+                    faces[cf[faceI]].size(),
                     ensightGeometryFile
                 );
             }
@@ -527,13 +539,13 @@ void Foam::ensightMesh::writePolysBinary
         {
             const labelList& cf = cellFaces[polys[i]];
 
-            forAll(cf, facei)
+            forAll(cf, faceI)
             {
-                const face& f = faces[cf[facei]];
+                const face& f = faces[cf[faceI]];
 
-                forAll(f, pointi)
+                forAll(f, pointI)
                 {
-                    writeEnsDataBinary(f[pointi] + po,ensightGeometryFile);
+                    writeEnsDataBinary(f[pointI] + po,ensightGeometryFile);
                 }
             }
         }
@@ -648,9 +660,9 @@ void Foam::ensightMesh::writeFacePrims
         {
             const face& patchFace = patchFaces[i];
 
-            forAll(patchFace, pointi)
+            forAll(patchFace, pointI)
             {
-                ensightGeometryFile << setw(10) << patchFace[pointi] + po;
+                ensightGeometryFile << setw(10) << patchFace[pointI] + po;
             }
             ensightGeometryFile << nl;
         }
@@ -690,11 +702,11 @@ void Foam::ensightMesh::writeFacePrimsBinary
         {
             const face& patchFace = patchFaces[i];
 
-            forAll(patchFace, pointi)
+            forAll(patchFace, pointI)
             {
                 writeEnsDataBinary
                 (
-                    patchFace[pointi] + po,
+                    patchFace[pointI] + po,
                     ensightGeometryFile
                 );
             }
@@ -892,7 +904,7 @@ void Foam::ensightMesh::writeAscii
             postProcPath/ensightGeometryFileName,
             runTime.writeFormat(),
             runTime.writeVersion(),
-            runTime.writeCompression()
+            IOstream::UNCOMPRESSED
         );
     }
 
@@ -909,8 +921,8 @@ void Foam::ensightMesh::writeAscii
         ensightGeometryFile.precision(5);
 
         ensightGeometryFile
-            << "OpenFOAM Geometry File " << nl
-            << "OpenFOAM version " << Foam::FOAMversion << nl
+            << "EnSight Geometry File" << nl
+            << "written from OpenFOAM-" << Foam::FOAMversion << nl
             << "node id assign" << nl
             << "element id assign" << nl;
     }
@@ -927,7 +939,7 @@ void Foam::ensightMesh::writeAscii
             ensightGeometryFile
                 << "part" << nl
                 << setw(10) << 1 << nl
-                << "FOAM cells" << nl
+                << "internalMesh" << nl
                 << "coordinates" << nl
                 << setw(10) << nPoints
                 << endl;
@@ -1038,7 +1050,7 @@ void Foam::ensightMesh::writeAscii
     }
 
 
-    label ensightPatchi = 2;
+    label ensightPatchI = patchPartOffset_;
 
     forAllConstIter(HashTable<labelList>, allPatchNames_, iter)
     {
@@ -1049,7 +1061,7 @@ void Foam::ensightMesh::writeAscii
             const word& patchName = iter.key();
             const nFacePrimitives& nfp = nPatchPrims_.find(patchName)();
 
-            const labelList *trisPtr = NULL;
+            const labelList *trisPtr  = NULL;
             const labelList *quadsPtr = NULL;
             const labelList *polysPtr = NULL;
 
@@ -1058,15 +1070,15 @@ void Foam::ensightMesh::writeAscii
 
             if (patchIndices_.found(iter.key()))
             {
-                label patchi = patchIndices_.find(iter.key())();
-                const polyPatch& p = mesh_.boundaryMesh()[patchi];
+                label patchI = patchIndices_.find(iter.key())();
+                const polyPatch& p = mesh_.boundaryMesh()[patchI];
 
-                trisPtr = &boundaryFaceSets_[patchi].tris;
-                quadsPtr = &boundaryFaceSets_[patchi].quads;
-                polysPtr = &boundaryFaceSets_[patchi].polys;
+                trisPtr  = &boundaryFaceSets_[patchI].tris;
+                quadsPtr = &boundaryFaceSets_[patchI].quads;
+                polysPtr = &boundaryFaceSets_[patchI].polys;
 
                 patchPointsPtr = &(p.localPoints());
-                patchFacesPtr = &(p.localFaces());
+                patchFacesPtr  = &(p.localFaces());
             }
 
             const labelList& tris = *trisPtr;
@@ -1083,7 +1095,7 @@ void Foam::ensightMesh::writeAscii
                 {
                     ensightGeometryFile
                         << "part" << nl
-                        << setw(10) << ensightPatchi++ << nl
+                        << setw(10) << ensightPatchI++ << nl
                         << patchName << nl
                         << "coordinates" << nl
                         << setw(10) << nfp.nPoints
@@ -1235,11 +1247,11 @@ void Foam::ensightMesh::writeBinary
 
     if (Pstream::master())
     {
-        writeEnsDataBinary("C binary",ensightGeometryFile);
-        writeEnsDataBinary("OpenFOAM Geometry File",ensightGeometryFile);
-        writeEnsDataBinary("Binary format",ensightGeometryFile);
-        writeEnsDataBinary("node id assign",ensightGeometryFile);
-        writeEnsDataBinary("element id assign",ensightGeometryFile);
+        writeEnsDataBinary("C binary", ensightGeometryFile);
+        writeEnsDataBinary("EnSight Geometry File", ensightGeometryFile);
+        writeEnsDataBinary("written from OpenFOAM", ensightGeometryFile);
+        writeEnsDataBinary("node id assign", ensightGeometryFile);
+        writeEnsDataBinary("element id assign", ensightGeometryFile);
     }
 
     labelList pointOffsets(Pstream::nProcs(), 0);
@@ -1364,8 +1376,7 @@ void Foam::ensightMesh::writeBinary
 
     }
 
-    label ensightPatchi = 2;
-
+    label ensightPatchI = patchPartOffset_;
     label iCount = 0;
 
     forAllConstIter(HashTable<labelList>, allPatchNames_, iter)
@@ -1387,12 +1398,12 @@ void Foam::ensightMesh::writeBinary
 
             if (patchIndices_.found(iter.key()))
             {
-                label patchi = patchIndices_.find(iter.key())();
-                const polyPatch& p = mesh_.boundaryMesh()[patchi];
+                label patchI = patchIndices_.find(iter.key())();
+                const polyPatch& p = mesh_.boundaryMesh()[patchI];
 
-                trisPtr = &boundaryFaceSets_[patchi].tris;
-                quadsPtr = &boundaryFaceSets_[patchi].quads;
-                polysPtr = &boundaryFaceSets_[patchi].polys;
+                trisPtr = &boundaryFaceSets_[patchI].tris;
+                quadsPtr = &boundaryFaceSets_[patchI].quads;
+                polysPtr = &boundaryFaceSets_[patchI].polys;
 
                 patchPointsPtr = &(p.localPoints());
                 patchFacesPtr = &(p.localFaces());
@@ -1411,7 +1422,7 @@ void Foam::ensightMesh::writeBinary
                 if (Pstream::master())
                 {
                     writeEnsDataBinary("part",ensightGeometryFile);
-                    writeEnsDataBinary(ensightPatchi++,ensightGeometryFile);
+                    writeEnsDataBinary(ensightPatchI++,ensightGeometryFile);
                     //writeEnsDataBinary(patchName.c_str(),ensightGeometryFile);
                     writeEnsDataBinary(iter.key().c_str(),ensightGeometryFile);
                     writeEnsDataBinary("coordinates",ensightGeometryFile);
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.H
index fff8b797ab6fb4c139801ff59ec154f0c010b591..6a3cb824708bb7a3e7543f327acc69fc2c918379 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.H
@@ -78,11 +78,14 @@ class ensightMesh
 
     // Private data
 
+        //- Reference to the OpenFOAM mesh
+        const fvMesh& mesh_;
+
         //- Set binary file output
         bool binary_;
 
-        //- Reference to the OpenFOAM mesh
-        const fvMesh& mesh_;
+        //- The ensight part id for the first patch
+        label patchPartOffset_;
 
         cellSets meshCellSets_;
 
@@ -286,6 +289,12 @@ public:
                 return nPatchPrims_;
             }
 
+            //- The ensight part id for the first patch
+            label patchPartOffset() const
+            {
+                return patchPartOffset_;
+            }
+
 
     // I-O
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
index 10d261bca5e508e59f19f4535f83eb2f2cb438de..881bb4b05a3ae7a5da76a3f6a500e68d7134bd3d 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C
@@ -23,7 +23,9 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Description
-    Translates FOAM data to EnSight format
+    Translates FOAM data to EnSight format.
+
+    An Ensight part is created for the internalMesh and for each patch.
 
 Usage
     - foamToEnsight [OPTION] \n
@@ -32,12 +34,21 @@ Usage
     @param -ascii \n
     Write Ensight data in ASCII format instead of "C Binary"
 
+    @param -patches patchList \n
+    Specify particular patches to write.
+    Specifying an empty list suppresses writing the internalMesh.
+
+    @param -noPatches \n
+    Suppress writing any patches.
+
 Note
     Parallel support for cloud data is not supported
+    - writes to @a EnSight directory to avoid collisions with foamToEnsightParts
 
 \*---------------------------------------------------------------------------*/
 
 #include "argList.H"
+#include "timeSelector.H"
 #include "IOobjectList.H"
 #include "IOmanip.H"
 #include "OFstream.H"
@@ -82,18 +93,15 @@ bool inFileNameList
 
 int main(int argc, char *argv[])
 {
-    argList::validOptions.insert("patches", "patch list");
     argList::validOptions.insert("ascii", "" );
-#   include "addTimeOptions.H"
+    argList::validOptions.insert("patches", "patchList");
+    argList::validOptions.insert("noPatches", "");
 
+#   include "addTimeOptions.H"
 #   include "setRootCase.H"
 
     // Check options
-    bool binary = true;
-    if (args.options().found("ascii"))
-    {
-        binary = false;
-    }
+    bool binary = !args.optionFound("ascii");
 
 #   include "createTime.H"
 
@@ -114,29 +122,28 @@ int main(int argc, char *argv[])
         regionPrefix = regionName;
     }
 
-    const label nTypes = 2;
-    const word fieldTypes[] =
+    const label nVolFieldTypes = 5;
+    const word volFieldTypes[] =
     {
         volScalarField::typeName,
-        volVectorField::typeName
+        volVectorField::typeName,
+        volSphericalTensorField::typeName,
+        volSymmTensorField::typeName,
+        volTensorField::typeName
     };
 
-    // Create the output folder
-    const word postProcDir = "EnSight";
-
     // Path to EnSight folder at case level only
     // - For parallel cases, data only written from master
-//    fileName postProcPath = runTime.path()/postProcDir;
-    fileName postProcPath = args.rootPath()/args.globalCaseName()/postProcDir;
+    fileName ensightDir = args.rootPath()/args.globalCaseName()/"EnSight";
 
     if (Pstream::master())
     {
-        if (isDir(postProcPath))
+        if (isDir(ensightDir))
         {
-            rmDir(postProcPath);
+            rmDir(ensightDir);
         }
 
-        mkDir(postProcPath);
+        mkDir(ensightDir);
     }
 
     // Start of case file header output
@@ -147,36 +154,23 @@ int main(int argc, char *argv[])
     OFstream *ensightCaseFilePtr = NULL;
     if (Pstream::master())
     {
-        fileName ensightCaseFileName = prepend + "case";
+        fileName caseFileName = prepend + "case";
+        Info<< nl << "write case: " << caseFileName.c_str() << endl;
 
-        if (!binary)
-        {
-            ensightCaseFilePtr = new OFstream
-            (
-                postProcPath/ensightCaseFileName,
-                runTime.writeFormat(),
-                runTime.writeVersion(),
-                runTime.writeCompression()
-            );
-        }
-        else
-        {
-            ensightCaseFilePtr = new OFstream
-            (
-                postProcPath/ensightCaseFileName,
-                runTime.writeFormat(),
-                runTime.writeVersion(),
-                IOstream::UNCOMPRESSED
-            );
-        }
+        // the case file is always ASCII
+        ensightCaseFilePtr = new OFstream
+        (
+            ensightDir/caseFileName,
+            IOstream::ASCII
+        );
 
-        Info<< nl << "Case file is " << ensightCaseFileName << endl;
+        *ensightCaseFilePtr
+            << "FORMAT" << nl
+            << "type: ensight gold" << nl << nl;
     }
 
     OFstream& ensightCaseFile = *ensightCaseFilePtr;
 
-#   include "ensightCaseHeader.H"
-
     // Construct the EnSight mesh
     ensightMesh eMesh(mesh, args, binary);
 
@@ -188,19 +182,20 @@ int main(int argc, char *argv[])
 #   include "checkMeshMoving.H"
 
     wordHashSet allCloudNames;
-    word geomCaseFileName = prepend + "000";
     if (Pstream::master())
     {
+        word geomFileName = prepend + "000";
+
         // test pre check variable if there is a moving mesh
-        if (meshMoving == true)
+        if (meshMoving)
         {
-            geomCaseFileName = prepend + "***";
+            geomFileName = prepend + "***";
         }
 
         ensightCaseFile
             << "GEOMETRY" << nl
             << "model:        1     "
-            << (geomCaseFileName + ".mesh").c_str() << nl;
+            << (geomFileName + ".mesh").c_str() << nl;
     }
 
     // Identify if lagrangian data exists at each time, and add clouds
@@ -304,7 +299,7 @@ int main(int argc, char *argv[])
         {
             eMesh.write
             (
-                postProcPath,
+                ensightDir,
                 prepend,
                 timeIndex,
                 ensightCaseFile
@@ -324,94 +319,94 @@ int main(int argc, char *argv[])
         // Cell field data output
         // ~~~~~~~~~~~~~~~~~~~~~~
 
-        for (label i=0; i<nTypes; i++)
+        for (label i=0; i<nVolFieldTypes; i++)
         {
-            wordList fieldNames = objects.names(fieldTypes[i]);
+            wordList fieldNames = objects.names(volFieldTypes[i]);
 
             for (label j=0; j<fieldNames.size(); j++)
             {
                 word fieldName = fieldNames[j];
 
-                bool variableGood = true;
-
 #               include "checkData.H"
 
-                if (variableGood)
+                if (!variableGood)
+                {
+                    continue;
+                }
+
+                IOobject fieldObject
+                (
+                    fieldName,
+                    mesh.time().timeName(),
+                    mesh,
+                    IOobject::MUST_READ,
+                    IOobject::NO_WRITE
+                );
+
+                if (volFieldTypes[i] == volScalarField::typeName)
                 {
-                    IOobject fieldObject
+                    ensightField<scalar>
                     (
-                        fieldName,
-                        mesh.time().timeName(),
-                        mesh,
-                        IOobject::MUST_READ,
-                        IOobject::NO_WRITE
+                        fieldObject,
+                        eMesh,
+                        ensightDir,
+                        prepend,
+                        timeIndex,
+                        binary,
+                        ensightCaseFile
+                    );
+                }
+                else if (volFieldTypes[i] == volVectorField::typeName)
+                {
+                    ensightField<vector>
+                    (
+                        fieldObject,
+                        eMesh,
+                        ensightDir,
+                        prepend,
+                        timeIndex,
+                        binary,
+                        ensightCaseFile
+                    );
+                }
+                else if (volFieldTypes[i] == volSphericalTensorField::typeName)
+                {
+                    ensightField<sphericalTensor>
+                    (
+                        fieldObject,
+                        eMesh,
+                        ensightDir,
+                        prepend,
+                        timeIndex,
+                        binary,
+                        ensightCaseFile
+                    );
+                }
+                else if (volFieldTypes[i] == volSymmTensorField::typeName)
+                {
+                    ensightField<symmTensor>
+                    (
+                        fieldObject,
+                        eMesh,
+                        ensightDir,
+                        prepend,
+                        timeIndex,
+                        binary,
+                        ensightCaseFile
+                    );
+                }
+                else if (volFieldTypes[i] == volTensorField::typeName)
+                {
+                    ensightField<tensor>
+                    (
+                        fieldObject,
+                        eMesh,
+                        ensightDir,
+                        prepend,
+                        timeIndex,
+                        binary,
+                        ensightCaseFile
                     );
-
-                    if (fieldTypes[i] == volScalarField::typeName)
-                    {
-                        ensightField<scalar>
-                        (
-                            fieldObject,
-                            eMesh,
-                            postProcPath,
-                            prepend,
-                            timeIndex,
-                            binary,
-                            ensightCaseFile
-                        );
-                    }
-                    else if (fieldTypes[i] == volVectorField::typeName)
-                    {
-                        ensightField<vector>
-                        (
-                            fieldObject,
-                            eMesh,
-                            postProcPath,
-                            prepend,
-                            timeIndex,
-                            binary,
-                            ensightCaseFile
-                        );
-                    }
-                    else if (fieldTypes[i] == volSphericalTensorField::typeName)
-                    {
-                        ensightField<sphericalTensor>
-                        (
-                            fieldObject,
-                            eMesh,
-                            postProcPath,
-                            prepend,
-                            timeIndex,
-                            binary,
-                            ensightCaseFile
-                        );
-                    }
-                    else if (fieldTypes[i] == volSymmTensorField::typeName)
-                    {
-                        ensightField<symmTensor>
-                        (
-                            fieldObject,
-                            eMesh,
-                            postProcPath,
-                            prepend,
-                            timeIndex,
-                            binary,
-                            ensightCaseFile
-                        );
-                    }
-                    else if (fieldTypes[i] == volTensorField::typeName)
-                    {
-                        ensightField<tensor>
-                        (
-                            fieldObject,
-                            eMesh,
-                            postProcPath,
-                            prepend,
-                            timeIndex,
-                            binary,
-                            ensightCaseFile
-                        );
-                    }
                 }
             }
         }
@@ -434,7 +429,7 @@ int main(int argc, char *argv[])
             ensightParticlePositions
             (
                 mesh,
-                postProcPath,
+                ensightDir,
                 timeFile,
                 cloudName,
                 cloudExists
@@ -460,7 +455,7 @@ int main(int argc, char *argv[])
                     ensightCloudField<scalar>
                     (
                         fieldObject,
-                        postProcPath,
+                        ensightDir,
                         prepend,
                         timeIndex,
                         cloudName,
@@ -473,7 +468,7 @@ int main(int argc, char *argv[])
                     ensightCloudField<vector>
                     (
                         fieldObject,
-                        postProcPath,
+                        ensightDir,
                         prepend,
                         timeIndex,
                         cloudName,
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H
index a9367daf8eb9870b055ecb1f5a2025eb39d3cee5..a5a2dd7d2d8d9e1b05c1c629fb4c6aa3935ed918 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/checkHasMovingMesh.H
@@ -6,15 +6,13 @@ if (timeDirs.size() > 1)
     hasMovingMesh = true;
     for (label i=0; i < timeDirs.size() && hasMovingMesh; ++i)
     {
-        IOobject io
+        hasMovingMesh = IOobject
         (
             "points",
             timeDirs[i].name(),
             polyMesh::meshSubDir,
             mesh,
             IOobject::NO_READ
-        );
-        
-        hasMovingMesh = io.headerOk();
+        ).headerOk();
     }
 }
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H
index edfbb5ae7d9b483fad7e7d7eb876ace2914750a2..63ef5eef21d7baee8c01bc8683fc29c16516cd4c 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/findFields.H
@@ -1,40 +1,40 @@
-// check the final time directory for
+// check the final time directory for the following:
 
 // 1. volume fields
 HashTable<word> volumeFields;
 
 // 2. the fields for each cloud:
-HashTable<HashTable<word> > cloudFields;
+HashTable< HashTable<word> > cloudFields;
 
-if (timeDirs.size() > 1)
+if (timeDirs.size())
 {
     IOobjectList objs(mesh, timeDirs[timeDirs.size()-1].name());
 
     forAllConstIter(IOobjectList, objs, fieldIter)
     {
         const IOobject& obj = *fieldIter();
+        const word& fieldName = obj.name();
+        const word& fieldType = obj.headerClassName();
 
-        if
-        (
-            obj.headerClassName() == volScalarField::typeName
-         || obj.headerClassName() == volVectorField::typeName
-        )
+        if (fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0")
+        {
+            // ignore _0 fields
+        }
+        else if (volFieldTypes.found(fieldType))
         {
-            // Add field and field type
-            volumeFields.insert
-            (
-                obj.name(),
-                obj.headerClassName()
-            );
+            // simply ignore types that we don't handle
+            volumeFields.insert(fieldName, fieldType);
         }
     }
 
-    // now check for lagrangian/<cloudName>
 
+    //
+    // now check for lagrangian/<cloudName>
+    //
     fileNameList cloudDirs = readDir
     (
         runTime.path()
-      / timeDirs[timeDirs.size() - 1].name()
+      / timeDirs[timeDirs.size()-1].name()
       / regionPrefix
       / cloud::prefix,
         fileName::DIRECTORY
@@ -47,42 +47,59 @@ if (timeDirs.size() > 1)
         // Create a new hash table for each cloud
         cloudFields.insert(cloudName, HashTable<word>());
 
-        // Identify the new cloud in the hash table
+        // Identify the new cloud within the hash table
         HashTable<HashTable<word> >::iterator cloudIter =
             cloudFields.find(cloudName);
 
-        IOobjectList cloudObjs
+        IOobjectList objs
         (
             mesh,
-            timeDirs[timeDirs.size() - 1].name(),
+            timeDirs[timeDirs.size()-1].name(),
             cloud::prefix/cloudName
         );
 
         bool hasPositions = false;
-        forAllConstIter(IOobjectList, cloudObjs, fieldIter)
+        forAllConstIter(IOobjectList, objs, fieldIter)
         {
             const IOobject obj = *fieldIter();
+            const word& fieldName = obj.name();
+            const word& fieldType = obj.headerClassName();
 
-            if (obj.name() == "positions")
+            if (fieldName == "positions")
             {
                 hasPositions = true;
             }
-            else
+            else if (cloudFieldTypes.found(fieldType))
             {
-                // Add field and field type
-                cloudIter().insert
-                (
-                    obj.name(),
-                    obj.headerClassName()
-                );
+                // simply ignore types that we don't handle
+                cloudIter().insert(fieldName, fieldType);
             }
         }
 
-        // drop this cloud if it has no positions
-        if (!hasPositions)
+        // drop this cloud if it has no positions or is otherwise empty
+        if (!hasPositions || cloudIter().empty())
         {
+            Info<< "removing cloud " << cloudName << endl;
             cloudFields.erase(cloudIter);
         }
     }
+
+    //
+    // verify that the variable is present for all times
+    //
+    for (label i=0; volumeFields.size() && i < timeDirs.size(); ++i)
+    {
+        IOobjectList objs(mesh, timeDirs[i].name());
+
+        forAllIter(HashTable<word>, volumeFields, fieldIter)
+        {
+            const word& fieldName = fieldIter.key();
+
+            if (!objs.found(fieldName))
+            {
+                volumeFields.erase(fieldIter);
+            }
+        }
+    }
 }
 
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C
index af2dee175a9351de1d961dc4b37d5061cc2858be..5e38986331d2b7a1c4edd86a30a0fe534b36bec3 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C
@@ -83,23 +83,19 @@ int main(int argc, char *argv[])
     argList::validOptions.insert("index",  "start");
     argList::validOptions.insert("noMesh", "");
 
-    const word volFieldTypes[] =
-    {
-        volScalarField::typeName,
-        volVectorField::typeName,
-        volSphericalTensorField::typeName,
-        volSymmTensorField::typeName,
-        volTensorField::typeName,
-        word::null
-    };
-
-    const word sprayFieldTypes[] =
-    {
-        scalarIOField::typeName,
-        vectorIOField::typeName,
-        tensorIOField::typeName,
-        word::null
-    };
+    // the volume field types that we handle
+    wordHashSet volFieldTypes;
+    volFieldTypes.insert(volScalarField::typeName);
+    volFieldTypes.insert(volVectorField::typeName);
+    volFieldTypes.insert(volSphericalTensorField::typeName);
+    volFieldTypes.insert(volSymmTensorField::typeName);
+    volFieldTypes.insert(volTensorField::typeName);
+
+    // the lagrangian field types that we handle
+    wordHashSet cloudFieldTypes;
+    cloudFieldTypes.insert(scalarIOField::typeName);
+    cloudFieldTypes.insert(vectorIOField::typeName);
+    cloudFieldTypes.insert(tensorIOField::typeName);
 
     const char* geometryName = "geometry";
 
@@ -111,7 +107,7 @@ int main(int argc, char *argv[])
 
     // default to binary output, unless otherwise specified
     IOstream::streamFormat format = IOstream::BINARY;
-    if (args.options().found("ascii"))
+    if (args.optionFound("ascii"))
     {
         format = IOstream::ASCII;
     }
@@ -119,14 +115,14 @@ int main(int argc, char *argv[])
     // control for renumbering iterations
     bool optIndex = false;
     label indexingNumber = 0;
-    if (args.options().found("index"))
+    if (args.optionFound("index"))
     {
         optIndex = true;
-        indexingNumber = readLabel(IStringStream(args.options()["index"])());
+        indexingNumber = args.optionRead<label>("index");
     }
 
     // always write the geometry, unless the -noMesh option is specified
-    bool optNoMesh = args.options().found("noMesh");
+    bool optNoMesh = args.optionFound("noMesh");
 
     fileName ensightDir = args.rootPath()/args.globalCaseName()/"Ensight";
     fileName dataDir = ensightDir/"data";
@@ -168,7 +164,6 @@ int main(int argc, char *argv[])
 
 #   include "checkHasMovingMesh.H"
 #   include "findFields.H"
-#   include "validateFields.H"
 
     if (hasMovingMesh && optNoMesh)
     {
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/moveMesh.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/moveMesh.H
index 546148c7cf2ed907b9ea3b1fcc11a50a9339ce17..284a0df35bba33901eda224f1dffe7eeb3954f96 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/moveMesh.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/moveMesh.H
@@ -11,8 +11,6 @@
     {
         // Read new points
         io.readOpt() = IOobject::MUST_READ;
-        pointIOField newPoints(io);
-
-        mesh.movePoints(newPoints);
+        mesh.movePoints(pointIOField(io));
     }
 }
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/validateFields.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/validateFields.H
deleted file mode 100644
index 6c640b41fa57efee651b694891cf819d460caeac..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/validateFields.H
+++ /dev/null
@@ -1,105 +0,0 @@
-// ignore special fields or fields that we don't handle
-//
-forAllIter(HashTable<word>, volumeFields, fieldIter)
-{
-    const word& fieldName = fieldIter.key();
-    const word& fieldType = fieldIter();
-
-    // ignore _0 fields
-    if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")
-    {
-        volumeFields.erase(fieldIter);
-    }
-    else
-    {
-        // remove types that we don't handle:
-        bool invalid = true;
-        for (label typeI=0; invalid && volFieldTypes[typeI].size(); ++typeI)
-        {
-            if (fieldType == volFieldTypes[typeI])
-            {
-                invalid = false;
-            }
-        }
-
-        if (invalid)
-        {
-            Info<< "ignoring " << fieldType << ": " << fieldName << endl;
-            volumeFields.erase(fieldIter);
-        }
-    }
-}
-
-// verify that the variable is present for all times
-//
-for (label i=0; volumeFields.size() && i < timeDirs.size(); ++i)
-{
-    IOobjectList objs(mesh, timeDirs[i].name());
-
-    forAllIter(HashTable<word>, volumeFields, fieldIter)
-    {
-        const word& fieldName = fieldIter.key();
-
-        if (!objs.found(fieldName))
-        {
-            volumeFields.erase(fieldIter);
-        }
-    }
-}
-
-
-
-// ignore fields that we don't handle
-//
-forAllIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
-{
-    const word& cloudName = cloudIter.key();
-
-    forAllIter(HashTable<word>, cloudIter(), fieldIter)
-    {
-        const word& fieldName = fieldIter.key();
-        const word& fieldType = fieldIter();
-
-        // remove types that we don't handle:
-        bool invalid = true;
-        for (label typeI=0; invalid && sprayFieldTypes[typeI].size(); ++typeI)
-        {
-            if (fieldType == sprayFieldTypes[typeI])
-            {
-                invalid = false;
-            }
-        }
-
-        if (invalid)
-        {
-            Info<< "ignoring " << fieldType << ": " << fieldName << endl;
-            cloudIter().erase(fieldIter);
-        }
-    }
-
-    if (cloudIter().empty())
-    {
-        Info<< "removing cloud " << cloudName << endl;
-        cloudFields.erase(cloudIter);
-    }
-}
-
-// DEBUGGING
-// Info<<"final fields (";
-// forAllConstIter(HashTable<word>, volumeFields, fieldIter)
-// {
-//     Info<< " " << fieldIter.key();
-// }
-//
-// Info<< " )\n";
-//
-// forAllConstIter(HashTable<HashTable<word> >, cloudFields, cloudIter)
-// {
-//     Info<<"final fields for lagrangian/" << cloudIter.key() << " (";
-//     forAllConstIter(HashTable<word>, cloudIter(), fieldIter)
-//     {
-//         Info<< " " << fieldIter.key();
-//     }
-//     Info<< " )\n";
-// }
-
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/checkTimeOption.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/checkTimeOption.H
deleted file mode 100644
index ad0aadf7c0f523a9790dacd005fe8ef989d9520a..0000000000000000000000000000000000000000
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/checkTimeOption.H
+++ /dev/null
@@ -1,26 +0,0 @@
-    if (args.options().found("time"))
-    {
-        scalar time(readScalar(IStringStream(args.options()["time"])()));
-
-        int nearestIndex = -1;
-        scalar nearestDiff = Foam::GREAT;
-
-        forAll(Times, timeIndex)
-        {
-            scalar diff = fabs(Times[timeIndex].value() - time);
-            if (diff < nearestDiff)
-            {
-                nearestDiff = diff;
-                nearestIndex = timeIndex;
-            }
-        }
-
-        startTime = nearestIndex;
-        endTime = nearestIndex + 1;
-    }
-    else
-    {
-        startTime = 0;
-        endTime = Times.size();
-    }
-
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C
index 7fc54a8cf2f76293c0a0e528a3d9f21260771db2..87270649df41445b6b77676ab141dfc0e155b68f 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C
@@ -23,7 +23,8 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Description
-    Write out the FOAM mesh in Version 3.0  Fieldview-UNS format (binary).
+    Write out the OpenFOAM mesh in Version 3.0 Fieldview-UNS format (binary).
+
     See Fieldview Release 9 Reference Manual - Appendix D
     (Unstructured Data Format)
     Borrows various from uns/write_binary_uns.c from FieldView dist.
@@ -31,6 +32,7 @@ Description
 \*---------------------------------------------------------------------------*/
 
 #include "argList.H"
+#include "timeSelector.H"
 #include "volFields.H"
 #include "surfaceFields.H"
 #include "pointFields.H"
@@ -176,20 +178,15 @@ int main(int argc, char *argv[])
 {
     argList::noParallel();
     argList::validOptions.insert("noWall", "");
+    timeSelector::addOptions(true, false);
 
-#   include "addTimeOptions.H"
 #   include "setRootCase.H"
 #   include "createTime.H"
 
-    instantList Times = runTime.times();
-
-#   include "checkTimeOptions.H"
-
-    runTime.setTime(Times[startTime], startTime);
+    instantList timeDirs = timeSelector::select0(runTime, args);
 
 #   include "createMesh.H"
 
-
     // Initialize name mapping table
     FieldviewNames.insert("alpha", "aalpha");
     FieldviewNames.insert("Alpha", "AAlpha");
@@ -285,17 +282,16 @@ int main(int argc, char *argv[])
 
     label fieldViewTime = 0;
 
-    for (label i=startTime; i<endTime; i++)
+    forAll(timeDirs, timeI)
     {
-        runTime.setTime(Times[i], i);
-
-        Info<< "Time " << Times[i].name() << endl;
+        runTime.setTime(timeDirs[timeI], timeI);
+        Info<< "Time: " << runTime.timeName() << endl;
 
         fvMesh::readUpdateState state = mesh.readUpdate();
 
         if
         (
-            i == startTime
+            timeI == 0
          || state == fvMesh::TOPO_CHANGE
          || state == fvMesh::TOPO_PATCH_CHANGE
         )
@@ -307,7 +303,7 @@ int main(int argc, char *argv[])
                 new fieldviewTopology
                 (
                     mesh,
-                    !args.options().found("noWall")
+                    !args.optionFound("noWall")
                 )
             );
 
@@ -334,7 +330,7 @@ int main(int argc, char *argv[])
 
         fileName fvFileName
         (
-            fvPath/runTime.caseName() + "_" + Foam::name(i) + ".uns"
+            fvPath/runTime.caseName() + "_" + Foam::name(timeI) + ".uns"
         );
 
         Info<< "    file:" << fvFileName.c_str() << endl;
@@ -364,7 +360,7 @@ int main(int argc, char *argv[])
 
         // Output constants for time, fsmach, alpha and re.
         float fBuf[4];
-        fBuf[0] = Times[i].value();
+        fBuf[0] = runTime.value();
         fBuf[1] = 0.0;
         fBuf[2] = 0.0;
         fBuf[3] = 1.0;
@@ -892,7 +888,7 @@ int main(int argc, char *argv[])
             writeInt(fvParticleFile, fieldViewTime + 1);
 
             // Time value
-            writeFloat(fvParticleFile, Times[i].value());
+            writeFloat(fvParticleFile, runTime.value());
 
             // Read particles
             Cloud<passiveParticle> parcels(mesh);
diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H
index 129d788738403040a45b32a823cc7036311c9e29..ec540efe7df467f5ce5136303309ce71eb3b602e 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/getFieldNames.H
@@ -5,9 +5,9 @@ HashSet<word> surfVectorHash;
 HashSet<word> sprayScalarHash;
 HashSet<word> sprayVectorHash;
 
-forAll(Times, timeI)
+forAll(timeDirs, timeI)
 {
-    runTime.setTime(Times[timeI], timeI);
+    runTime.setTime(timeDirs[timeI], timeI);
 
     // Add all fields to hashtable
     IOobjectList objects(mesh, runTime.timeName());
diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
index 2d5e7479906befdf04c420de5409f1db7c274328..9bce0df59f259b5849ab9209e2ef6a94c78c264b 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
+++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C
@@ -246,11 +246,10 @@ int main(int argc, char *argv[])
 #   include "setRootCase.H"
 #   include "createTime.H"
 
-    bool doWriteInternal = !args.options().found("noInternal");
-    bool doFaceZones = !args.options().found("noFaceZones");
-    bool doLinks = !args.options().found("noLinks");
-
-    bool binary = !args.options().found("ascii");
+    bool doWriteInternal = !args.optionFound("noInternal");
+    bool doFaceZones     = !args.optionFound("noFaceZones");
+    bool doLinks         = !args.optionFound("noLinks");
+    bool binary          = !args.optionFound("ascii");
 
     if (binary && (sizeof(floatScalar) != 4 || sizeof(label) != 4))
     {
@@ -260,7 +259,7 @@ int main(int argc, char *argv[])
             << exit(FatalError);
     }
 
-    bool nearCellValue = args.options().found("nearCellValue");
+    bool nearCellValue = args.optionFound("nearCellValue");
 
     if (nearCellValue)
     {
@@ -269,7 +268,7 @@ int main(int argc, char *argv[])
             << nl << endl;
     }
 
-    bool noPointValues = args.options().found("noPointValues");
+    bool noPointValues = args.optionFound("noPointValues");
 
     if (noPointValues)
     {
@@ -277,12 +276,12 @@ int main(int argc, char *argv[])
             << "Outputting cell values only" << nl << endl;
     }
 
-    bool allPatches = args.options().found("allPatches");
+    bool allPatches = args.optionFound("allPatches");
 
     HashSet<word> excludePatches;
-    if (args.options().found("excludePatches"))
+    if (args.optionFound("excludePatches"))
     {
-        IStringStream(args.options()["excludePatches"])() >> excludePatches;
+        args.optionLookup("excludePatches")() >> excludePatches;
 
         Info<< "Not including patches " << excludePatches << nl << endl;
     }
@@ -290,9 +289,9 @@ int main(int argc, char *argv[])
     word cellSetName;
     string vtkName;
 
-    if (args.options().found("cellSet"))
+    if (args.optionFound("cellSet"))
     {
-        cellSetName = args.options()["cellSet"];
+        cellSetName = args.option("cellSet");
         vtkName = cellSetName;
     }
     else if (Pstream::parRun())
@@ -332,8 +331,8 @@ int main(int argc, char *argv[])
     {
         if
         (
-            args.options().found("time")
-         || args.options().found("latestTime")
+            args.optionFound("time")
+         || args.optionFound("latestTime")
          || cellSetName.size()
          || regionName != polyMesh::defaultRegion
         )
@@ -377,10 +376,10 @@ int main(int argc, char *argv[])
 
 
         // If faceSet: write faceSet only (as polydata)
-        if (args.options().found("faceSet"))
+        if (args.optionFound("faceSet"))
         {
             // Load the faceSet
-            faceSet set(mesh, args.options()["faceSet"]);
+            faceSet set(mesh, args.option("faceSet"));
 
             // Filename as if patch with same name.
             mkDir(fvPath/set.name());
@@ -400,10 +399,10 @@ int main(int argc, char *argv[])
             continue;
         }
         // If pointSet: write pointSet only (as polydata)
-        if (args.options().found("pointSet"))
+        if (args.optionFound("pointSet"))
         {
             // Load the pointSet
-            pointSet set(mesh, args.options()["pointSet"]);
+            pointSet set(mesh, args.option("pointSet"));
 
             // Filename as if patch with same name.
             mkDir(fvPath/set.name());
@@ -428,9 +427,9 @@ int main(int argc, char *argv[])
         IOobjectList objects(mesh, runTime.timeName());
 
         HashSet<word> selectedFields;
-        if (args.options().found("fields"))
+        if (args.optionFound("fields"))
         {
-            IStringStream(args.options()["fields"])() >> selectedFields;
+            args.optionLookup("fields")() >> selectedFields;
         }
 
         // Construct the vol fields (on the original mesh if subsetted)
@@ -608,7 +607,7 @@ int main(int argc, char *argv[])
         //
         //---------------------------------------------------------------------
 
-        if (args.options().found("surfaceFields"))
+        if (args.optionFound("surfaceFields"))
         {
             PtrList<surfaceScalarField> ssf;
             readFields
diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C
index 118e99fc9101c2fd64a0cddae1c6a9e28c198008..04518db985c1db2a5245f464b364613a456ed84b 100644
--- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C
+++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C
@@ -113,11 +113,9 @@ int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[])
     instantList Times = runTime.times();
 
     int nearestIndex = timeIndex_;
-
     for (int requestI = 0; requestI < nRequest; ++requestI)
     {
         int index = Time::findClosestTimeIndex(Times, requestTimes[requestI]);
-
         if (index >= 0 && index != timeIndex_)
         {
             nearestIndex = index;
@@ -125,7 +123,6 @@ int Foam::vtkPV3Foam::setTime(int nRequest, const double requestTimes[])
         }
     }
 
-
     if (nearestIndex < 0)
     {
         nearestIndex = 0;
diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_maxsize_info.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_maxsize_info.H
index e143dd359d5dedb6a3a0a5a9ef764f2709222182..7c4ef69a4fd06f91e26a2ce00cefdae159743af5 100644
--- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_maxsize_info.H
+++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_maxsize_info.H
@@ -8,7 +8,7 @@ int USERD_get_maxsize_info
     return Z_ERR; 
 
 #ifdef ENSIGHTDEBUG
-    Info << "Entering: USERD_get_maxsize_info" << endl << flush;
+    Info << "Entering: USERD_get_maxsize_info" << endl;
 #endif
 
     label maxNPoints = 0;
@@ -19,9 +19,9 @@ int USERD_get_maxsize_info
     label nPyr05Max = 0;
     label nTet04Max = 0;
 
-    Info << "Checking all time steps for EnSight memory allocation purpose. This can take some time." << endl;
+    Info<< "Checking all time steps for EnSight memory allocation purpose. This can take some time." << endl;
 
-    for (label t=1; t < TimeList.size(); t++)
+    for (label timeI=1; timeI < timeDirs.size(); ++timeI)
     {
 
         label nPen06 = 0;
@@ -29,21 +29,21 @@ int USERD_get_maxsize_info
         label nPyr05 = 0;
         label nTet04 = 0;
 
-        runTimePtr->setTime(TimeList[t], t);
+        runTimePtr->setTime(timeDirs[timeI], timeI);
 
-        Info << "Checking time = " << TimeList[t].value() << endl << flush;
+        Info<< "Checking time = " << runTimePtr->timeName() << endl;
 
         const cellShapeList& cells = meshPtr->cellShapes();
         
-        label nPoints = meshPtr->nPoints();
-        label nCells = cells.size();
+        const label nPoints = meshPtr->nPoints();
+        const label nCells  = cells.size();
         
         maxNPoints = max(maxNPoints, nPoints);
 
         for (label n=0; n<nCells;n++)
         {
             label nFaces = cells[n].nFaces();
-            labelList points = cells[n];
+            const labelList& points = cells[n];
 
             if ((nFaces == 6) && (points.size() == 8))
             {
@@ -70,7 +70,6 @@ int USERD_get_maxsize_info
 
         if (Numparts_available > 1)
         {
-
             // Get the maximum number of spray parcels
             // and store it
             Cloud<passiveParticle> lagrangian(*meshPtr);
@@ -79,9 +78,7 @@ int USERD_get_maxsize_info
             {
                 nMaxParcels = lagrangian.size();
             }
-
         }
-
     }
 
     max_number_of_nodes[0] = maxNPoints;
@@ -97,7 +94,7 @@ int USERD_get_maxsize_info
     }
 
 #ifdef ENSIGHTDEBUG
-    Info << "Leaving: USERD_get_maxsize_info" << endl << flush;
+    Info<< "Leaving: USERD_get_maxsize_info" << endl;
 #endif
 
     return Z_OK;
diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_sol_times.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_sol_times.H
index 353b67def1551dd4838481a0fdfe339caa26d418..dcc64822897df9246929b025bf1e64e61167673d 100644
--- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_sol_times.H
+++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_sol_times.H
@@ -10,18 +10,18 @@ int USERD_get_sol_times
 )
 {
 #ifdef ENSIGHTDEBUG
-    Info << "Entering: USERD_get_sol_times" << endl << flush;
-    Info << TimeList << endl;
+    Info<< "Entering: USERD_get_sol_times\n" << timeDirs << endl;
 #endif
+
     for (label n=0; n<Num_time_steps;n++)
     {
-        solution_times[n] = TimeList[n+1].value();
+        solution_times[n] = timeDirs[n+1].value();
     }
 
-    if (TimeList[1].value() < 0)
+    if (timeDirs[1].value() < 0)
     {
         scalar addCAD = 360.0;
-        while (TimeList[1].value() + addCAD < 0.0)
+        while (timeDirs[1].value() + addCAD < 0.0)
         {
             addCAD += 360.0;
         }
@@ -29,14 +29,14 @@ int USERD_get_sol_times
         {
             solution_times[n] += addCAD;
 
-            Info << "Time[" << n << "] = " << TimeList[n+1].value()
+            Info << "Time[" << n << "] = " << timeDirs[n+1].value()
                 << " was corrected to " << solution_times[n]  << endl;
         }
 
     }
 
 #ifdef ENSIGHTDEBUG
-    Info << "Leaving: USERD_get_sol_times" << endl << flush;
+    Info<< "Leaving: USERD_get_sol_times" << endl;
 #endif
 
     return Z_OK;
diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_timeset_description.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_timeset_description.H
index 6eebf9b345ced343d96cc57f4d59328b79f27290..e3c98ba240127ba9047968c11c5a162113632bc9 100644
--- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_timeset_description.H
+++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_get_timeset_description.H
@@ -4,13 +4,12 @@ int USERD_get_timeset_description
     char timeset_description[Z_BUFL]
 )
 {
-   
+
 #ifdef ENSIGHTDEBUG
-    Info << "Entering: USERD_get_timeset_description" << endl 
-        << flush;
+    Info<< "Entering: USERD_get_timeset_description" << endl;
 #endif
 
-    if (TimeList[1].value() < 0)
+    if (timeDirs[1].value() < 0)
     {
         strncpy(timeset_description, "CAD", Z_BUFL);
     }
@@ -20,8 +19,7 @@ int USERD_get_timeset_description
     }
 
 #ifdef ENSIGHTDEBUG
-    Info << "Leaving: USERD_get_timeset_description" << endl 
-        << flush;
+    Info<< "Leaving: USERD_get_timeset_description" << endl;
 #endif
 
     return Z_OK;
diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H
index 83303fef717fdea9600e8e7331f3270d5cbce984..712ce53b869072019ca37fa40c749d35197b1b2f 100644
--- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H
+++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H
@@ -79,18 +79,18 @@ int USERD_set_filenames
     );
 
     // set the available number of time-steps
-    TimeList = (const instantList&)Foam::Time::findTimes(rootDir/caseDir);
+    timeDirs = Foam::Time::findTimes(rootDir/caseDir);
 
-    Num_time_steps = TimeList.size() - 1;
+    Num_time_steps = timeDirs.size() - 1;
 
     nPatches = meshPtr->boundaryMesh().size();
 
     // set the number of fields and store their names
     // a valid field must exist for all time-steps
-    runTime.setTime(TimeList[TimeList.size()-1], TimeList.size()-1);
+    runTime.setTime(timeDirs[timeDirs.size()-1], timeDirs.size()-1);
     IOobjectList objects(*meshPtr, runTime.timeName());
 
-    fieldNames = (const wordList&)objects.names();
+    fieldNames = objects.names();
 
     // because of the spray being a 'field' ...
     // get the availabe number of variables and
@@ -149,7 +149,7 @@ int USERD_set_filenames
     label n = 0;
     while (!lagrangianNamesFound && n < Num_time_steps)
     {
-        runTime.setTime(TimeList[n+1], n+1);
+        runTime.setTime(timeDirs[n+1], n+1);
 
         Cloud<passiveParticle> lagrangian(*meshPtr);
 
@@ -195,7 +195,7 @@ int USERD_set_filenames
     }
 
     Current_time_step = Num_time_steps;
-    runTime.setTime(TimeList[Current_time_step], Current_time_step);
+    runTime.setTime(timeDirs[Current_time_step], Current_time_step);
 
     Num_variables = nVar + nSprayVariables;
     Numparts_available = Num_unstructured_parts + Num_structured_parts + nPatches;
diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_time_set_and_step.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_time_set_and_step.H
index ef2f9a24531ed8f5b3a6371cb0ef247ed204c264..5e4c5815323af4948db69d381d5e37483bbb0185 100644
--- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_time_set_and_step.H
+++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_time_set_and_step.H
@@ -20,18 +20,30 @@ void USERD_set_time_set_and_step
 
         if (time_step == 0)
         {
-            runTime.setTime(TimeList[Current_time_step], Current_time_step);
+            runTime.setTime
+            (
+                timeDirs[Current_time_step],
+                Current_time_step
+            );
         }
         else
         {
-            runTime.setTime(TimeList[Current_time_step + 1], Current_time_step + 1);
+            runTime.setTime
+            (
+                timeDirs[Current_time_step + 1],
+                Current_time_step + 1
+            );
         }
 
         meshPtr->readUpdate();
 
         if (time_step == 0)
         {
-            runTime.setTime(TimeList[Current_time_step + 1], Current_time_step + 1);
+            runTime.setTime
+            (
+                timeDirs[Current_time_step + 1],
+                Current_time_step + 1
+            );
         }
 
         if (Numparts_available > nPatches+1)
diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H
index 80c71ba028062eebb8eeabb88e9607cf19e3d6b7..c6548c1408279dce2d0e92c827b814caab09d51c 100644
--- a/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H
+++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/getLagrangianVector.H
@@ -5,7 +5,6 @@ nVar -= Num_variables - nSprayVariables + lagrangianScalarNames.size();
 
 if (nVar >= 0)
 {
-
     word name = lagrangianVectorNames[nVar];
 
     IOField<vector> v
@@ -42,7 +41,7 @@ if (nVar >= 0)
 }
 else
 {
-    //Info << "getLagrangianVector: nVar = " << nVar << endl;
+    // Info<< "getLagrangianVector: nVar = " << nVar << endl;
     return Z_UNDEF;
 }
 
diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/globalFoam.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/globalFoam.H
index d68861b138e6cb79159d94767c0206769c2baa5c..7c7f2b16d822c6dfdf43ffeb78322234063529f9 100644
--- a/applications/utilities/postProcessing/graphics/ensightFoamReader/globalFoam.H
+++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/globalFoam.H
@@ -41,7 +41,7 @@ static word pointPrepend           = "point_";
 static fileName rootDir;
 static fileName caseDir;
 
-static instantList TimeList;
+static instantList timeDirs;
 
 static List<word> fieldNames;
 static List<word> lagrangianScalarNames;
diff --git a/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C
index ee4fd2c50f28c66a602156710dfe90575174e5e3..15c1153db5b17dec5191b50311c85937d588e88b 100644
--- a/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C
+++ b/applications/utilities/postProcessing/miscellaneous/dsmcFieldsCalc/dsmcFieldsCalc.C
@@ -82,7 +82,7 @@ namespace Foam
 
 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
 {
-    bool writeResults = !args.options().found("noWrite");
+    bool writeResults = !args.optionFound("noWrite");
 
     wordList extensiveVSFNames
     (
diff --git a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C
index 45faede694f7a240f624fd4b6054da2207b49693..0843f3acf3b72ea161cfb5958493373792787fac 100644
--- a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C
+++ b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C
@@ -53,15 +53,13 @@ namespace Foam
 {
     void execFlowFunctionObjects(const argList& args, const Time& runTime)
     {
-        if (args.options().found("dict"))
+        if (args.optionFound("dict"))
         {
-            fileName dictName(args.options()["dict"]);
-
             IOdictionary dict
             (
                 IOobject
                 (
-                    dictName,
+                    args.option("dict"),
                     runTime.system(),
                     runTime,
                     IOobject::MUST_READ
diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/calculateFields.H b/applications/utilities/postProcessing/miscellaneous/postChannel/calculateFields.H
index e4f4f411e1a1e56e017b2a9bc5de4407d3437108..6c7cffcf0ad300c7d95042c0fa44c06de822c03c 100644
--- a/applications/utilities/postProcessing/miscellaneous/postChannel/calculateFields.H
+++ b/applications/utilities/postProcessing/miscellaneous/postChannel/calculateFields.H
@@ -12,7 +12,7 @@
             IOobject
             (
                 "txx",
-                Times[i].name(),
+                runTime.timeName(),
                 mesh,
                 IOobject::NO_READ,
                 IOobject::NO_WRITE
@@ -28,7 +28,7 @@
             IOobject
             (
                 "tyy",
-                Times[i].name(),
+                runTime.timeName(),
                 mesh,
                 IOobject::NO_READ,
                 IOobject::NO_WRITE
@@ -44,7 +44,7 @@
             IOobject
             (
                 "tzz",
-                Times[i].name(),
+                runTime.timeName(),
                 mesh,
                 IOobject::NO_READ,
                 IOobject::NO_WRITE
@@ -60,7 +60,7 @@
             IOobject
             (
                 "txy",
-                Times[i].name(),
+                runTime.timeName(),
                 mesh,
                 IOobject::NO_READ,
                 IOobject::NO_WRITE
diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C
index 943bff5811f05f92a7291978bf95d371a1f7e1a4..559e769cf1c293e3de4ca34a1ce4751ad72de5c9 100644
--- a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C
+++ b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C
@@ -48,18 +48,13 @@ Description
 int main(int argc, char *argv[])
 {
     argList::noParallel();
-#   include "addTimeOptions.H"
-#   include "setRootCase.H"
+    timeSelector::addOptions();
 
+#   include "setRootCase.H"
 #   include "createTime.H"
 
     // Get times list
-    instantList Times = runTime.times();
-
-    // set startTime and endTime depending on -time and -latestTime options
-#   include "checkTimeOptions.H"
-
-    runTime.setTime(Times[startTime], startTime);
+    instantList timeDirs = timeSelector::select0(runTime, args);
 
 #   include "createMesh.H"
 #   include "readTransportProperties.H"
@@ -83,10 +78,9 @@ int main(int argc, char *argv[])
 
 
     // For each time step read all fields
-    for (label i=startTime; i<endTime; i++)
+    forAll(timeDirs, timeI)
     {
-        runTime.setTime(Times[i], i);
-
+        runTime.setTime(timeDirs[timeI], timeI);
         Info<< "Collapsing fields for time " << runTime.timeName() << endl;
 
 #       include "readFields.H"
@@ -96,7 +90,7 @@ int main(int argc, char *argv[])
 #       include "collapse.H"
     }
 
-    Info<< "end" << endl;
+    Info<< "\nEnd" << endl;
 
     return 0;
 }
diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H b/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H
index d281b6335144fd968eb021f9573dcb3ce079718d..e0ce9b1f6da71c361a6a0b62dffca7111ede1f2a 100644
--- a/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H
+++ b/applications/utilities/postProcessing/miscellaneous/postChannel/readFields.H
@@ -1,7 +1,7 @@
     IOobject UMeanHeader
     (
         "UMean",
-        runTime.times()[i].name(),
+        runTime.timeName(),
         mesh,
         IOobject::MUST_READ
     );
@@ -23,7 +23,7 @@
         IOobject
         (
             "UPrime2Mean",
-            runTime.times()[i].name(),
+            runTime.timeName(),
             mesh,
             IOobject::MUST_READ
         ),
@@ -39,7 +39,7 @@
         IOobject
         (
             "pPrime2Mean",
-            runTime.times()[i].name(),
+            runTime.timeName(),
             mesh,
             IOobject::MUST_READ
         ),
@@ -52,7 +52,7 @@
         IOobject
         (
             "epsilonMean",
-            runTime.times()[i].name(),
+            runTime.timeName(),
             mesh,
             IOobject::MUST_READ
         ),
@@ -64,7 +64,7 @@
         IOobject
         (
             "nuMean",
-            runTime.times()[i].name(),
+            runTime.timeName(),
             mesh,
             IOobject::MUST_READ
         ),
@@ -76,7 +76,7 @@
         IOobject
         (
             "gammaDotMean",
-            runTime.times()[i].name(),
+            runTime.timeName(),
             mesh,
             IOobject::MUST_READ
         ),
@@ -88,7 +88,7 @@
         IOobject
         (
             "nuPrime",
-            runTime.times()[i].name(),
+            runTime.timeName(),
             mesh,
             IOobject::MUST_READ
         ),
@@ -102,7 +102,7 @@
         IOobject
         (
             "gammaDotPrime",
-            runTime.times()[i].name(),
+            runTime.timeName(),
             mesh,
             IOobject::MUST_READ
         ),
diff --git a/applications/utilities/postProcessing/velocityField/Co/Co.C b/applications/utilities/postProcessing/velocityField/Co/Co.C
index 694172b72438b95227fcee8a7bd559b0dbdbe593..23d7b008a7d3dddd22b4f7f736975d71e7ec4c2a 100644
--- a/applications/utilities/postProcessing/velocityField/Co/Co.C
+++ b/applications/utilities/postProcessing/velocityField/Co/Co.C
@@ -86,7 +86,7 @@ namespace Foam
 
 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
 {
-    bool writeResults = !args.options().found("noWrite");
+    bool writeResults = !args.optionFound("noWrite");
 
     IOobject phiHeader
     (
diff --git a/applications/utilities/postProcessing/velocityField/Mach/Mach.C b/applications/utilities/postProcessing/velocityField/Mach/Mach.C
index 02c69df34a07f8b44668dc2a69190ae62ad80101..daa4aa2ccf3d7aef33eef506761f46cb7c168a1c 100644
--- a/applications/utilities/postProcessing/velocityField/Mach/Mach.C
+++ b/applications/utilities/postProcessing/velocityField/Mach/Mach.C
@@ -38,7 +38,7 @@ Description
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
 {
-    bool writeResults = !args.options().found("noWrite");
+    bool writeResults = !args.optionFound("noWrite");
 
     IOobject Uheader
     (
diff --git a/applications/utilities/postProcessing/velocityField/Pe/Pe.C b/applications/utilities/postProcessing/velocityField/Pe/Pe.C
index 08c333481683ea08c9bf925db87300198f4bfe47..905074131d9f32b2d3d199dc8f12aae410343cb1 100644
--- a/applications/utilities/postProcessing/velocityField/Pe/Pe.C
+++ b/applications/utilities/postProcessing/velocityField/Pe/Pe.C
@@ -47,7 +47,7 @@ Description
 
 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
 {
-    bool writeResults = !args.options().found("noWrite");
+    bool writeResults = !args.optionFound("noWrite");
 
     IOobject phiHeader
     (
diff --git a/applications/utilities/postProcessing/velocityField/Q/Q.C b/applications/utilities/postProcessing/velocityField/Q/Q.C
index e2338189546a1917c0bebb5a5b5679fd2c5746fd..34a09790d145896619e846f2e33d42bf379f9a00 100644
--- a/applications/utilities/postProcessing/velocityField/Q/Q.C
+++ b/applications/utilities/postProcessing/velocityField/Q/Q.C
@@ -39,7 +39,7 @@ Description
 
 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
 {
-    bool writeResults = !args.options().found("noWrite");
+    bool writeResults = !args.optionFound("noWrite");
 
     IOobject Uheader
     (
diff --git a/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy.C b/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy.C
index 5d098240fdd72e50de54558a712b0f16564c7319..96ccb4b9079920f86d3b5b5304deb2aaff9af349 100644
--- a/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy.C
+++ b/applications/utilities/postProcessing/velocityField/enstrophy/enstrophy.C
@@ -39,7 +39,7 @@ Description
 
 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
 {
-    bool writeResults = !args.options().found("noWrite");
+    bool writeResults = !args.optionFound("noWrite");
 
     IOobject Uheader
     (
diff --git a/applications/utilities/postProcessing/velocityField/uprime/uprime.C b/applications/utilities/postProcessing/velocityField/uprime/uprime.C
index a546cab627bf7d2ba1d132961e1a3d4ef0ff3454..c1f7071f744d1cb2e8ba9260a257f50a5839e5e6 100644
--- a/applications/utilities/postProcessing/velocityField/uprime/uprime.C
+++ b/applications/utilities/postProcessing/velocityField/uprime/uprime.C
@@ -39,7 +39,7 @@ Description
 
 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
 {
-    bool writeResults = !args.options().found("noWrite");
+    bool writeResults = !args.optionFound("noWrite");
 
     IOobject kheader
     (
diff --git a/applications/utilities/postProcessing/velocityField/vorticity/vorticity.C b/applications/utilities/postProcessing/velocityField/vorticity/vorticity.C
index e24a3b9e463b8e1e8afcaf6e63e8830796a7455a..3b4a85ca3e603927a8fed3b3257ce64b6d36ff07 100644
--- a/applications/utilities/postProcessing/velocityField/vorticity/vorticity.C
+++ b/applications/utilities/postProcessing/velocityField/vorticity/vorticity.C
@@ -39,7 +39,7 @@ Description
 
 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
 {
-    bool writeResults = !args.options().found("noWrite");
+    bool writeResults = !args.optionFound("noWrite");
 
     IOobject Uheader
     (
diff --git a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C
index dac7cd03934ada77c1c586b0320d5cdf4a301aaf..8aae7e124c965d5c0a0e249b6b1e70d0ba901bd4 100644
--- a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C
+++ b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C
@@ -76,16 +76,15 @@ int main(int argc, char *argv[])
     // Set the mean boundary-layer thickness
     dimensionedScalar ybl("ybl", dimLength, 0);
 
-    if (args.options().found("ybl"))
+    if (args.optionFound("ybl"))
     {
         // If the boundary-layer thickness is provided use it
-        ybl.value() = readScalar(IStringStream(args.options()["ybl"])());
+        ybl.value() = args.optionRead<scalar>("ybl");
     }
-    else if (args.options().found("Cbl"))
+    else if (args.optionFound("Cbl"))
     {
         // Calculate boundary layer thickness as Cbl * mean distance to wall
-        ybl.value() =
-            gAverage(y)*readScalar(IStringStream(args.options()["Cbl"])());
+        ybl.value() = gAverage(y) * args.optionRead<scalar>("Cbl");
     }
     else
     {
@@ -155,7 +154,7 @@ int main(int argc, char *argv[])
         sqr(kappa*min(y, ybl))*::sqrt(2)*mag(dev(symm(fvc::grad(U))))
     );
 
-    if (args.options().found("writenut"))
+    if (args.optionFound("writenut"))
     {
         Info<< "Writing nut" << endl;
         nut.write();
diff --git a/applications/utilities/preProcessing/applyWallFunctionBounaryConditions/applyWallFunctionBounaryConditions.C b/applications/utilities/preProcessing/applyWallFunctionBounaryConditions/applyWallFunctionBounaryConditions.C
index e571cc4373f42948202f6ff8fc42ea51895ce17a..1cdc3f28abe605beedac2880e0a5c9e2f5942b54 100644
--- a/applications/utilities/preProcessing/applyWallFunctionBounaryConditions/applyWallFunctionBounaryConditions.C
+++ b/applications/utilities/preProcessing/applyWallFunctionBounaryConditions/applyWallFunctionBounaryConditions.C
@@ -240,7 +240,7 @@ int main(int argc, char *argv[])
 #   include "createTime.H"
 #   include "createMesh.H"
 
-    bool compressible = args.options().found("compressible");
+    bool compressible = args.optionFound("compressible");
 
     Info<< "Updating turbulence fields to operate using new run time "
         << "selectable" << nl << "wall functions"
diff --git a/applications/utilities/preProcessing/foamUpgradeFvSolution/foamUpgradeFvSolution.C b/applications/utilities/preProcessing/foamUpgradeFvSolution/foamUpgradeFvSolution.C
index 669d7186f2460f48ec7ef0812c84dfa5ff958a12..d2e7981c68394aec4edead2391aa80a4e21faa68 100644
--- a/applications/utilities/preProcessing/foamUpgradeFvSolution/foamUpgradeFvSolution.C
+++ b/applications/utilities/preProcessing/foamUpgradeFvSolution/foamUpgradeFvSolution.C
@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
     Info<< nChanged << " solver settings changed" << nl << endl;
     if (nChanged)
     {
-        if (args.options().found("test"))
+        if (args.optionFound("test"))
         {
             Info<< "-test option: no changes made" << nl << endl;
         }
diff --git a/applications/utilities/preProcessing/mapFields/createTimes.H b/applications/utilities/preProcessing/mapFields/createTimes.H
index b7c8a1fe3343ea9426217c41890bcdf7819f5f93..8367e595579842d813bbd2d15945ffc63d5c16d0 100644
--- a/applications/utilities/preProcessing/mapFields/createTimes.H
+++ b/applications/utilities/preProcessing/mapFields/createTimes.H
@@ -1,4 +1,4 @@
-    Info<< nl << "Create databases as time" << endl;
+    Info << "\nCreate databases as time" << endl;
 
     Time runTimeSource
     (
diff --git a/applications/utilities/preProcessing/mapFields/mapFields.C b/applications/utilities/preProcessing/mapFields/mapFields.C
index bd840ab267a26bf21e126bd3f130601f869d2e44..fde815d76faa06334770adb5c0a9857478ae4a0e 100644
--- a/applications/utilities/preProcessing/mapFields/mapFields.C
+++ b/applications/utilities/preProcessing/mapFields/mapFields.C
@@ -43,31 +43,6 @@ Description
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-int getTimeIndex
-(
-    const instantList& times,
-    const scalar t
-)
-{
-    int nearestIndex = -1;
-    scalar nearestDiff = Foam::GREAT;
-
-    forAll(times, timeIndex)
-    {
-        if (times[timeIndex].name() == "constant") continue;
-
-        scalar diff = fabs(times[timeIndex].value() - t);
-        if (diff < nearestDiff)
-        {
-            nearestDiff = diff;
-            nearestIndex = timeIndex;
-        }
-    }
-
-    return nearestIndex;
-}
-
-
 void mapConsistentMesh
 (
     const fvMesh& meshSource,
@@ -254,9 +229,7 @@ wordList addProcessorPatches
 int main(int argc, char *argv[])
 {
 #   include "setRoots.H"
-
 #   include "createTimes.H"
-
 #   include "setTimeIndex.H"
 
     runTimeSource.setTime(sourceTimes[sourceTimeIndex], sourceTimeIndex);
@@ -357,7 +330,7 @@ int main(int argc, char *argv[])
             }
         }
     }
-    else if(!parallelSource && parallelTarget)
+    else if (!parallelSource && parallelTarget)
     {
         IOdictionary decompositionDict
         (
@@ -426,7 +399,7 @@ int main(int argc, char *argv[])
             }
         }
     }
-    else if(parallelSource && parallelTarget)
+    else if (parallelSource && parallelTarget)
     {
         IOdictionary decompositionDictSource
         (
diff --git a/applications/utilities/preProcessing/mapFields/setRoots.H b/applications/utilities/preProcessing/mapFields/setRoots.H
index 5c4ca191700f9942eb6544ad1d6ac3e29db190be..6aceba234f46e8d0326a343feb91d04ea2765253 100644
--- a/applications/utilities/preProcessing/mapFields/setRoots.H
+++ b/applications/utilities/preProcessing/mapFields/setRoots.H
@@ -24,20 +24,7 @@
     Info<< "Source: " << rootDirSource << " " << caseDirSource << nl
         << "Target: " << rootDirTarget << " " << caseDirTarget << endl;
 
-    bool parallelSource = false;
-    if (args.options().found("parallelSource"))
-    {
-        parallelSource = true;
-    }
+    bool parallelSource = args.optionFound("parallelSource");
+    bool parallelTarget = args.optionFound("parallelTarget");
+    bool consistent     = args.optionFound("consistent");
 
-    bool parallelTarget = false;
-    if (args.options().found("parallelTarget"))
-    {
-        parallelTarget = true;
-    }
-
-    bool consistent = false;
-    if (args.options().found("consistent"))
-    {
-        consistent = true;
-    }
diff --git a/applications/utilities/preProcessing/mapFields/setTimeIndex.H b/applications/utilities/preProcessing/mapFields/setTimeIndex.H
index c5afed3e2fbc15c2ba54620b4325c95aa63dee6d..19efd9ff5b4bc80ebe49a0b941fe999daee6221d 100644
--- a/applications/utilities/preProcessing/mapFields/setTimeIndex.H
+++ b/applications/utilities/preProcessing/mapFields/setTimeIndex.H
@@ -1,20 +1,25 @@
     instantList sourceTimes = runTimeSource.times();
     label sourceTimeIndex = runTimeSource.timeIndex();
-    if (args.options().found("sourceTime"))
+    if (args.optionFound("sourceTime"))
     {
-        if ((args.options()["sourceTime"]) == "latestTime")
+        if (args.option("sourceTime") == "latestTime")
         {
             sourceTimeIndex = sourceTimes.size() - 1;
         }
         else
         {
-            scalar sourceTime =
-                readScalar(IStringStream(args.options()["sourceTime"])());
-            sourceTimeIndex = getTimeIndex(sourceTimes, sourceTime);
+            sourceTimeIndex = Time::findClosestTimeIndex
+            (
+                sourceTimes,
+                args.optionRead<scalar>("sourceTime")
+            );
         }
     }
     else
     {
-        scalar sourceTime = runTimeTarget.time().value();
-        sourceTimeIndex = getTimeIndex(sourceTimes, sourceTime);
+        sourceTimeIndex = Time::findClosestTimeIndex
+        (
+            sourceTimes,
+            runTimeTarget.time().value()
+        );
     }
diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C
index 085a1abe2d1ddec95a378b248add668a1fef410e..5ba3727b39bb794d2fdeff316abc67f30589bfeb 100644
--- a/applications/utilities/preProcessing/setFields/setFields.C
+++ b/applications/utilities/preProcessing/setFields/setFields.C
@@ -28,6 +28,7 @@ Description
 \*---------------------------------------------------------------------------*/
 
 #include "argList.H"
+#include "timeSelector.H"
 #include "Time.H"
 #include "fvMesh.H"
 #include "topoSetSource.H"
@@ -174,19 +175,13 @@ public:
 
 int main(int argc, char *argv[])
 {
+    timeSelector::addOptions();
 
-#   include "addTimeOptions.H"
 #   include "setRootCase.H"
-
 #   include "createTime.H"
 
     // Get times list
-    instantList Times = runTime.times();
-
-    // set startTime and endTime depending on -time and -latestTime options
-#   include "checkTimeOptions.H"
-
-    runTime.setTime(Times[startTime], startTime);
+    instantList timeDirs = timeSelector::select0(runTime, args);
 
 #   include "createMesh.H"
 
@@ -220,11 +215,11 @@ int main(int argc, char *argv[])
 
     PtrList<entry> regions(setFieldsDict.lookup("regions"));
 
-    forAll(regions, regioni)
+    forAll(regions, regionI)
     {
-        const entry& region = regions[regioni];
+        const entry& region = regions[regionI];
 
-        autoPtr<topoSetSource> cellSelector = 
+        autoPtr<topoSetSource> cellSelector =
             topoSetSource::New(region.keyword(), mesh, region.dict());
 
         cellSet selectedCellSet
@@ -247,7 +242,7 @@ int main(int argc, char *argv[])
         );
     }
 
-    Info << nl << "End" << endl;
+    Info<< "\nEnd" << endl;
 
     return 0;
 }
diff --git a/applications/utilities/surface/surfaceAdd/surfaceAdd.C b/applications/utilities/surface/surfaceAdd/surfaceAdd.C
index bbff3715c7c8d3e64be96a0318097734dd3af075..6441486cd129b0339145acde979b4b7b9db07452 100644
--- a/applications/utilities/surface/surfaceAdd/surfaceAdd.C
+++ b/applications/utilities/surface/surfaceAdd/surfaceAdd.C
@@ -59,8 +59,8 @@ int main(int argc, char *argv[])
     fileName inFileName2(args.additionalArgs()[1]);
     fileName outFileName(args.additionalArgs()[2]);
 
-    bool addPoint = args.options().found("points");
-    bool mergeRegions = args.options().found("mergeRegions");
+    bool addPoint     = args.optionFound("points");
+    bool mergeRegions = args.optionFound("mergeRegions");
 
     if (addPoint)
     {
@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
             << nl << endl;
 
         Info<< "Surface  : " << inFileName1<< nl
-            << "Points   : " << args.options()["points"] << nl
+            << "Points   : " << args.option("points") << nl
             << "Writing  : " << outFileName << nl << endl;
     }
     else
@@ -111,8 +111,8 @@ int main(int argc, char *argv[])
 
     if (addPoint)
     {
-        IFstream pointStr(args.options()["points"]);
-        pointField extraPoints(pointStr);
+        IFstream pointsFile(args.option("points"));
+        pointField extraPoints(pointsFile);
 
         Info<< "Additional Points:" << extraPoints.size() << endl;
 
@@ -252,7 +252,7 @@ int main(int argc, char *argv[])
                 newPatches[newPatchI++] = surface2.patches()[ patchI];
             }
         }
- 
+
 
         Info<< "New patches:" << nl;
         forAll(newPatches, patchI)
diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C
index d714c19ec36e5bc5be435b9ac3a02349274954f2..d283ec66afc37ba554e37ddcb6d84df7dc5ce105 100644
--- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C
+++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C
@@ -176,8 +176,8 @@ int main(int argc, char *argv[])
     argList::validOptions.insert("verbose", "");
     argList args(argc, argv);
 
-    bool checkSelfIntersection = args.options().found("checkSelfIntersection");
-    bool verbose = args.options().found("verbose");
+    bool checkSelfIntersection = args.optionFound("checkSelfIntersection");
+    bool verbose = args.optionFound("verbose");
 
     fileName surfFileName(args.additionalArgs()[0]);
     Pout<< "Reading surface from " << surfFileName << " ..." << nl << endl;
diff --git a/applications/utilities/surface/surfaceConvert/surfaceConvert.C b/applications/utilities/surface/surfaceConvert/surfaceConvert.C
index fd7b223827334261083e944fb9d559be218c4106..f7df57d1e1844037d6fab413aeda49715c8395fe 100644
--- a/applications/utilities/surface/surfaceConvert/surfaceConvert.C
+++ b/applications/utilities/surface/surfaceConvert/surfaceConvert.C
@@ -70,12 +70,6 @@ int main(int argc, char *argv[])
     argList args(argc, argv);
     const stringList& params = args.additionalArgs();
 
-    scalar scaleFactor = 0;
-    if (args.options().found("scale"))
-    {
-        IStringStream(args.options()["scale"])() >> scaleFactor;
-    }
-
     fileName importName(params[0]);
     fileName exportName(params[1]);
 
@@ -93,7 +87,7 @@ int main(int argc, char *argv[])
     surf.writeStats(Info);
     Info<< endl;
 
-    if (args.options().found("clean"))
+    if (args.optionFound("clean"))
     {
         Info<< "Cleaning up surface" << endl;
         surf.cleanup(true);
@@ -103,7 +97,7 @@ int main(int argc, char *argv[])
         Info<< endl;
     }
 
-    bool sortByRegion = args.options().found("group");
+    bool sortByRegion = args.optionFound("group");
 
     if (sortByRegion)
     {
@@ -115,7 +109,9 @@ int main(int argc, char *argv[])
     }
 
     Info<< "writing " << exportName;
-    if (scaleFactor > 0)
+
+    scalar scaleFactor = 0;
+    if (args.optionReadIfPresent("scale", scaleFactor) && scaleFactor > 0)
     {
         Info<< " with scaling " << scaleFactor;
         surf.scalePoints(scaleFactor);
diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C
index 8907ac46dbef278d7f02caa80e22bc46dbed87a2..c3a7e5a26dd827dbc21484aefb1c6d7e42dff4e0 100644
--- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C
+++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C
@@ -110,7 +110,7 @@ int main(int argc, char *argv[])
     argList::validOptions.insert("deleteBox", "((x0 y0 z0)(x1 y1 z1))");
     argList args(argc, argv);
 
-    Pout<< "Feature line extraction is only valid on closed manifold surfaces." 
+    Pout<< "Feature line extraction is only valid on closed manifold surfaces."
         << endl;
 
 
@@ -139,27 +139,24 @@ int main(int argc, char *argv[])
 
     surfaceFeatures set(surf);
 
-    if (args.options().found("set"))
+    if (args.optionFound("set"))
     {
-        fileName setName(args.options()["set"]);
+        fileName setName(args.option("set"));
 
         Pout<< "Reading existing feature set from file " << setName << endl;
 
         set = surfaceFeatures(surf, setName);
     }
-    else if (args.options().found("includedAngle"))
+    else if (args.optionFound("includedAngle"))
     {
-        scalar includedAngle
-        (
-            readScalar(IStringStream(args.options()["includedAngle"])())
-        );
+        scalar includedAngle = args.optionRead<scalar>("includedAngle");
 
         Pout<< "Constructing feature set from included angle " << includedAngle
             << endl;
 
         set = surfaceFeatures(surf, includedAngle);
 
-        Pout<< endl << "Writing initial features" << endl;    
+        Pout<< endl << "Writing initial features" << endl;
         set.write("initial.fSet");
         set.writeObj("initial");
     }
@@ -190,16 +187,14 @@ int main(int argc, char *argv[])
     // ~~~~~~~~
 
     scalar minLen = -GREAT;
-    if (args.options().found("minLen"))
+    if (args.optionReadIfPresent("minLen", minLen))
     {
-        minLen = readScalar(IStringStream(args.options()["minLen"])());
         Pout<< "Removing features of length < " << minLen << endl;
     }
-    
+
     label minElem = 0;
-    if (args.options().found("minElem"))
+    if (args.optionReadIfPresent("minElem", minElem))
     {
-        minElem = readLabel(IStringStream(args.options()["minElem"])());
         Pout<< "Removing features with number of edges < " << minElem << endl;
     }
 
@@ -207,7 +202,7 @@ int main(int argc, char *argv[])
     if (minLen > 0 || minLen > 0)
     {
         set.trimFeatures(minLen, minElem);
-        Pout<< endl << "Removed small features" << endl;    
+        Pout<< endl << "Removed small features" << endl;
     }
 
 
@@ -218,9 +213,9 @@ int main(int argc, char *argv[])
     // Convert to marked edges, points
     List<surfaceFeatures::edgeStatus> edgeStat(set.toStatus());
 
-    if (args.options().found("subsetBox"))
+    if (args.optionFound("subsetBox"))
     {
-        treeBoundBox bb(IStringStream(args.options()["subsetBox"])());
+        treeBoundBox bb(args.optionLookup("subsetBox")());
 
         Pout<< "Removing all edges outside bb " << bb << endl;
         dumpBox(bb, "subsetBox.obj");
@@ -233,9 +228,9 @@ int main(int argc, char *argv[])
             edgeStat
         );
     }
-    else if (args.options().found("deleteBox"))
+    else if (args.optionFound("deleteBox"))
     {
-        treeBoundBox bb(IStringStream(args.options()["deleteBox"])());
+        treeBoundBox bb(args.optionLookup("deleteBox")());
 
         Pout<< "Removing all edges inside bb " << bb << endl;
         dumpBox(bb, "deleteBox.obj");
@@ -254,7 +249,7 @@ int main(int argc, char *argv[])
 
     Pout<< endl << "Writing trimmed features to " << outFileName << endl;
     newSet.write(outFileName);
-    
+
     Pout<< endl << "Writing edge objs." << endl;
     newSet.writeObj("final");
 
diff --git a/applications/utilities/surface/surfaceFind/surfaceFind.C b/applications/utilities/surface/surfaceFind/surfaceFind.C
index e162c179b69548021f5641a45ea0cbfb3c5de3a3..13d769fd1a7795b25c10fab05b888abc923b1e73 100644
--- a/applications/utilities/surface/surfaceFind/surfaceFind.C
+++ b/applications/utilities/surface/surfaceFind/surfaceFind.C
@@ -52,10 +52,12 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
 
-    scalar x(readScalar(IStringStream(args.options()["x"])()));
-    scalar y(readScalar(IStringStream(args.options()["y"])()));
-    scalar z(readScalar(IStringStream(args.options()["z"])()));
-    point samplePt(x, y, z);
+    point samplePt
+    (
+        args.optionRead<scalar>("x"),
+        args.optionRead<scalar>("y"),
+        args.optionRead<scalar>("z")
+    );
     Info<< "Looking for nearest face/vertex to " << samplePt << endl;
 
 
diff --git a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C
index 4f607e89fb15b477ddc6238805068db482c5d80a..6e730cc60ab3ef201ca86de13f11c4400513f925 100644
--- a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C
+++ b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C
@@ -110,13 +110,13 @@ int main(int argc, char *argv[])
     autoPtr<coordinateSystem> fromCsys;
     autoPtr<coordinateSystem> toCsys;
 
-    if (args.options().found("from") || args.options().found("to"))
+    if (args.optionFound("from") || args.optionFound("to"))
     {
         autoPtr<IOobject> csDictIoPtr;
 
-        if (args.options().found("dict"))
+        if (args.optionFound("dict"))
         {
-            fileName dictPath(args.options()["dict"]);
+            fileName dictPath(args.option("dict"));
 
             csDictIoPtr.set
             (
@@ -161,9 +161,9 @@ int main(int argc, char *argv[])
 
         coordinateSystems csLst(csDictIoPtr());
 
-        if (args.options().found("from"))
+        if (args.optionFound("from"))
         {
-            const word csName(args.options()["from"]);
+            const word csName(args.option("from"));
 
             label csId = csLst.find(csName);
             if (csId < 0)
@@ -177,9 +177,9 @@ int main(int argc, char *argv[])
             fromCsys.reset(new coordinateSystem(csLst[csId]));
         }
 
-        if (args.options().found("to"))
+        if (args.optionFound("to"))
         {
-            const word csName(args.options()["to"]);
+            const word csName(args.option("to"));
 
             label csId = csLst.find(csName);
             if (csId < 0)
@@ -203,32 +203,23 @@ int main(int argc, char *argv[])
         }
     }
 
-    scalar scaleIn = 0;
-    scalar scaleOut = 0;
-    if (args.options().found("scaleIn"))
-    {
-        IStringStream(args.options()["scaleIn"])() >> scaleIn;
-    }
-    if (args.options().found("scaleOut"))
-    {
-        IStringStream(args.options()["scaleOut"])() >> scaleOut;
-    }
-
 
     {
         MeshedSurface<face> surf(importName);
 
-        if (args.options().found("clean"))
+        if (args.optionFound("clean"))
         {
             surf.cleanup(true);
         }
 
-        if (scaleIn > 0)
+        scalar scaleIn = 0;
+        if (args.optionReadIfPresent("scaleIn", scaleIn) && scaleIn > 0)
         {
             Info<< " -scaleIn " << scaleIn << endl;
             surf.scalePoints(scaleIn);
         }
 
+
         if (fromCsys.valid())
         {
             Info<< " -from " << fromCsys().name() << endl;
@@ -243,7 +234,8 @@ int main(int argc, char *argv[])
             surf.movePoints(tpf());
         }
 
-        if (scaleOut > 0)
+        scalar scaleOut = 0;
+        if (args.optionReadIfPresent("scaleOut", scaleOut) && scaleOut > 0)
         {
             Info<< " -scaleOut " << scaleOut << endl;
             surf.scalePoints(scaleOut);
diff --git a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
index f245e4088bcb300b122f19e5ec5a6ddf2ceb97d9..e53a8616d824e3ad1d61a6542f8a35fcb7c940e1 100644
--- a/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
+++ b/applications/utilities/surface/surfaceMeshConvertTesting/surfaceMeshConvertTesting.C
@@ -86,10 +86,7 @@ int main(int argc, char *argv[])
     const stringList& params = args.additionalArgs();
 
     scalar scaleFactor = 0;
-    if (args.options().found("scale"))
-    {
-        IStringStream(args.options()["scale"])() >> scaleFactor;
-    }
+    args.optionReadIfPresent("scale", scaleFactor);
 
     fileName importName(params[0]);
     fileName exportName(params[1]);
@@ -110,7 +107,7 @@ int main(int argc, char *argv[])
         return 1;
     }
 
-    if (args.options().found("triSurface"))
+    if (args.optionFound("triSurface"))
     {
         triSurface surf(importName);
 
@@ -118,14 +115,14 @@ int main(int argc, char *argv[])
         surf.writeStats(Info);
         Info<< endl;
 
-        if (args.options().found("orient"))
+        if (args.optionFound("orient"))
         {
             Info<< "Checking surface orientation" << endl;
             PatchTools::checkOrientation(surf, true);
             Info<< endl;
         }
 
-        if (args.options().found("clean"))
+        if (args.optionFound("clean"))
         {
             Info<< "Cleaning up surface" << endl;
             surf.cleanup(true);
@@ -149,7 +146,7 @@ int main(int argc, char *argv[])
         // write sorted by region
         surf.write(exportName, true);
     }
-    else if (args.options().found("unsorted"))
+    else if (args.optionFound("unsorted"))
     {
         UnsortedMeshedSurface<face> surf(importName);
 
@@ -157,14 +154,14 @@ int main(int argc, char *argv[])
         surf.writeStats(Info);
         Info<< endl;
 
-        if (args.options().found("orient"))
+        if (args.optionFound("orient"))
         {
             Info<< "Checking surface orientation" << endl;
             PatchTools::checkOrientation(surf, true);
             Info<< endl;
         }
 
-        if (args.options().found("clean"))
+        if (args.optionFound("clean"))
         {
             Info<< "Cleaning up surface" << endl;
             surf.cleanup(true);
@@ -187,7 +184,7 @@ int main(int argc, char *argv[])
         surf.write(exportName);
     }
 #if 1
-    else if (args.options().found("triFace"))
+    else if (args.optionFound("triFace"))
     {
         MeshedSurface<triFace> surf(importName);
 
@@ -195,14 +192,14 @@ int main(int argc, char *argv[])
         surf.writeStats(Info);
         Info<< endl;
 
-        if (args.options().found("orient"))
+        if (args.optionFound("orient"))
         {
             Info<< "Checking surface orientation" << endl;
             PatchTools::checkOrientation(surf, true);
             Info<< endl;
         }
 
-        if (args.options().found("clean"))
+        if (args.optionFound("clean"))
         {
             Info<< "Cleaning up surface" << endl;
             surf.cleanup(true);
@@ -233,14 +230,14 @@ int main(int argc, char *argv[])
         surf.writeStats(Info);
         Info<< endl;
 
-        if (args.options().found("orient"))
+        if (args.optionFound("orient"))
         {
             Info<< "Checking surface orientation" << endl;
             PatchTools::checkOrientation(surf, true);
             Info<< endl;
         }
 
-        if (args.options().found("clean"))
+        if (args.optionFound("clean"))
         {
             Info<< "Cleaning up surface" << endl;
             surf.cleanup(true);
@@ -263,7 +260,7 @@ int main(int argc, char *argv[])
         }
         surf.write(exportName);
 
-        if (args.options().found("surfMesh"))
+        if (args.optionFound("surfMesh"))
         {
             Foam::Time runTime
             (
diff --git a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C
index 34d93c93ebecb6e0f51f905366c33342b365fde4..b6538d0bc17900e50a8cf57635b7078aecd04b3a 100644
--- a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C
+++ b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C
@@ -89,6 +89,7 @@ int main(int argc, char *argv[])
 
     fileName exportName(params[0]);
     word importName("default");
+    args.optionReadIfPresent("name", importName);
 
     // check that writing is supported
     if (!MeshedSurface<face>::canWriteType(exportName.ext(), true))
@@ -96,23 +97,18 @@ int main(int argc, char *argv[])
         return 1;
     }
 
-    if (args.options().found("name"))
-    {
-        importName = args.options()["name"];
-    }
-
 
     // get the coordinate transformations
     autoPtr<coordinateSystem> fromCsys;
     autoPtr<coordinateSystem> toCsys;
 
-    if (args.options().found("from") || args.options().found("to"))
+    if (args.optionFound("from") || args.optionFound("to"))
     {
         autoPtr<IOobject> ioPtr;
 
-        if (args.options().found("dict"))
+        if (args.optionFound("dict"))
         {
-            fileName dictPath(args.options()["dict"]);
+            fileName dictPath(args.option("dict"));
 
             ioPtr.set
             (
@@ -157,9 +153,9 @@ int main(int argc, char *argv[])
 
         coordinateSystems csLst(ioPtr());
 
-        if (args.options().found("from"))
+        if (args.optionFound("from"))
         {
-            const word csName(args.options()["from"]);
+            const word csName(args.option("from"));
 
             label csId = csLst.find(csName);
             if (csId < 0)
@@ -173,9 +169,9 @@ int main(int argc, char *argv[])
             fromCsys.reset(new coordinateSystem(csLst[csId]));
         }
 
-        if (args.options().found("to"))
+        if (args.optionFound("to"))
         {
-            const word csName(args.options()["to"]);
+            const word csName(args.option("to"));
 
             label csId = csLst.find(csName);
             if (csId < 0)
@@ -219,24 +215,13 @@ int main(int argc, char *argv[])
 
     MeshedSurface<face> surf(smesh);
 
-    if (args.options().found("clean"))
+    if (args.optionFound("clean"))
     {
         surf.cleanup(true);
     }
 
     scalar scaleIn = 0;
-    scalar scaleOut = 0;
-    if (args.options().found("scaleIn"))
-    {
-        IStringStream(args.options()["scaleIn"])() >> scaleIn;
-    }
-    if (args.options().found("scaleOut"))
-    {
-        IStringStream(args.options()["scaleOut"])() >> scaleOut;
-    }
-
-
-    if (scaleIn > 0)
+    if (args.optionReadIfPresent("scaleIn", scaleIn) && scaleIn > 0)
     {
         Info<< " -scaleIn " << scaleIn << endl;
         surf.scalePoints(scaleIn);
@@ -256,7 +241,8 @@ int main(int argc, char *argv[])
         surf.movePoints(tpf());
     }
 
-    if (scaleOut > 0)
+    scalar scaleOut = 0;
+    if (args.optionReadIfPresent("scaleOut", scaleOut) && scaleOut > 0)
     {
         Info<< " -scaleOut " << scaleOut << endl;
         surf.scalePoints(scaleOut);
diff --git a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C
index 0cb131e4ebefded7fb56483c137ed23f55b3fc86..808eefcd76c0104f5243fe99bc398cf4e2f7023d 100644
--- a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C
+++ b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C
@@ -103,6 +103,7 @@ int main(int argc, char *argv[])
 
     fileName importName(params[0]);
     word exportName("default");
+    args.optionReadIfPresent("name", exportName);
 
     // check that reading is supported
     if (!MeshedSurface<face>::canRead(importName, true))
@@ -110,23 +111,18 @@ int main(int argc, char *argv[])
         return 1;
     }
 
-    if (args.options().found("name"))
-    {
-        exportName = args.options()["name"];
-    }
-
 
     // get the coordinate transformations
     autoPtr<coordinateSystem> fromCsys;
     autoPtr<coordinateSystem> toCsys;
 
-    if (args.options().found("from") || args.options().found("to"))
+    if (args.optionFound("from") || args.optionFound("to"))
     {
         autoPtr<IOobject> ioPtr;
 
-        if (args.options().found("dict"))
+        if (args.optionFound("dict"))
         {
-            fileName dictPath(args.options()["dict"]);
+            fileName dictPath(args.option("dict"));
 
             ioPtr.set
             (
@@ -171,9 +167,9 @@ int main(int argc, char *argv[])
 
         coordinateSystems csLst(ioPtr());
 
-        if (args.options().found("from"))
+        if (args.optionFound("from"))
         {
-            const word csName(args.options()["from"]);
+            const word csName(args.option("from"));
 
             label csId = csLst.find(csName);
             if (csId < 0)
@@ -187,9 +183,9 @@ int main(int argc, char *argv[])
             fromCsys.reset(new coordinateSystem(csLst[csId]));
         }
 
-        if (args.options().found("to"))
+        if (args.optionFound("to"))
         {
-            const word csName(args.options()["to"]);
+            const word csName(args.option("to"));
 
             label csId = csLst.find(csName);
             if (csId < 0)
@@ -217,25 +213,14 @@ int main(int argc, char *argv[])
 
     MeshedSurface<face> surf(importName);
 
-    if (args.options().found("clean"))
+    if (args.optionFound("clean"))
     {
         surf.cleanup(true);
     }
 
 
     scalar scaleIn = 0;
-    scalar scaleOut = 0;
-    if (args.options().found("scaleIn"))
-    {
-        IStringStream(args.options()["scaleIn"])() >> scaleIn;
-    }
-    if (args.options().found("scaleOut"))
-    {
-        IStringStream(args.options()["scaleOut"])() >> scaleOut;
-    }
-
-
-    if (scaleIn > 0)
+    if (args.optionReadIfPresent("scaleIn", scaleIn) && scaleIn > 0)
     {
         Info<< " -scaleIn " << scaleIn << endl;
         surf.scalePoints(scaleIn);
@@ -255,7 +240,8 @@ int main(int argc, char *argv[])
         surf.movePoints(tpf());
     }
 
-    if (scaleOut > 0)
+    scalar scaleOut = 0;
+    if (args.optionReadIfPresent("scaleOut", scaleOut) && scaleOut > 0)
     {
         Info<< " -scaleOut " << scaleOut << endl;
         surf.scalePoints(scaleOut);
diff --git a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
index a57f7c9d48de064208d21658246fc6fd80c253f1..3ea9e07a82e02f278f2d70275014151d50796a1f 100644
--- a/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
+++ b/applications/utilities/surface/surfaceMeshTriangulate/surfaceMeshTriangulate.C
@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
 
     bool includeProcPatches =
        !(
-            args.options().found("excludeProcPatches")
+            args.optionFound("excludeProcPatches")
          || Pstream::parRun()
         );
 
@@ -78,15 +78,15 @@ int main(int argc, char *argv[])
     // - all patches (default in sequential mode)
     // - all non-processor patches (default in parallel mode)
     // - all non-processor patches (sequential mode, -excludeProcPatches option)
-    
+
     // Construct table of patches to include.
     const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
 
     labelHashSet includePatches(bMesh.size());
 
-    if (args.options().found("patches"))
+    if (args.optionFound("patches"))
     {
-        wordList patchNames(IStringStream(args.options()["patches"])());
+        wordList patchNames(args.optionLookup("patches")());
 
         forAll(patchNames, patchNameI)
         {
diff --git a/applications/utilities/surface/surfaceOrient/surfaceOrient.C b/applications/utilities/surface/surfaceOrient/surfaceOrient.C
index 720b858a211fc3b17e574b679ed5ef296d686840..1b728711cdce6ff1c052009698d5a5c3e19cad83 100644
--- a/applications/utilities/surface/surfaceOrient/surfaceOrient.C
+++ b/applications/utilities/surface/surfaceOrient/surfaceOrient.C
@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
     point visiblePoint(IStringStream(args.additionalArgs()[1])());
     Info<< "Visible point " << visiblePoint << endl;
 
-    bool orientInside = args.options().found("inside");
+    bool orientInside = args.optionFound("inside");
 
     if (orientInside)
     {
diff --git a/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C b/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C
index b56c8e2cf0c8f0be83f9bbf079d967e5d07f7cf2..8608fe33af6a6c8291bf8fbf06264b809b3049be 100644
--- a/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C
+++ b/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C
@@ -692,7 +692,7 @@ int main(int argc, char *argv[])
 
     fileName inSurfName(args.additionalArgs()[0]);
     fileName outSurfName(args.additionalArgs()[1]);
-    bool debug = args.options().found("debug");
+    bool debug = args.optionFound("debug");
 
 
     Info<< "Reading surface from " << inSurfName << endl;
diff --git a/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C b/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C
index baf64f35555ffd0d8d75e906e2d38bb10aca233f..87ce69ddf77b49e8b52ede588d7918f4f83fd07d 100644
--- a/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C
+++ b/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C
@@ -177,12 +177,12 @@ int main(int argc, char *argv[])
 
     Info<< "Reading surface from " << surfName << " ..." << endl;
 
-    bool readSet = args.options().found("faceSet");
+    bool readSet = args.optionFound("faceSet");
     word setName;
 
     if (readSet)
     {
-        setName = args.options()["faceSet"];
+        setName = args.option("faceSet");
 
         Info<< "Repatching only the faces in faceSet " << setName
             << " according to nearest surface triangle ..." << endl;
@@ -194,11 +194,7 @@ int main(int argc, char *argv[])
     }
 
     scalar searchTol = 1E-3;
-
-    if (args.options().found("tol"))
-    {
-        searchTol =  readScalar(IStringStream(args.options()["tol"])());
-    }
+    args.optionReadIfPresent("tol", searchTol);
 
     // Get search box. Anything not within this box will not be considered.
     const boundBox& meshBb = mesh.globalData().bb();
diff --git a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C
index 1d4597515d818d59f46eee4da17abee34d1ee34e..c3243b71ae82f02347fa25c4a98cae57b8626705 100644
--- a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C
+++ b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C
@@ -86,18 +86,18 @@ int main(int argc, char *argv[])
 
     pointField points(surf1.points());
 
-    if (args.options().found("translate"))
+    if (args.optionFound("translate"))
     {
-        vector transVector(IStringStream(args.options()["translate"])());
+        vector transVector(args.optionLookup("translate")());
 
         Info<< "Translating points by " << transVector << endl;
 
         points += transVector;
     }
 
-    if (args.options().found("rotate"))
+    if (args.optionFound("rotate"))
     {
-        Pair<vector> n1n2(IStringStream(args.options()["rotate"])());
+        Pair<vector> n1n2(args.optionLookup("rotate")());
         n1n2[0] /= mag(n1n2[0]);
         n1n2[1] /= mag(n1n2[1]);
 
@@ -107,9 +107,9 @@ int main(int argc, char *argv[])
 
         points = transform(T, points);
     }
-    else if (args.options().found("rollPitchYaw"))
+    else if (args.optionFound("rollPitchYaw"))
     {
-        vector v(IStringStream(args.options()["rollPitchYaw"])());
+        vector v(args.optionLookup("rollPitchYaw")());
 
         Info<< "Rotating points by" << nl
             << "    roll  " << v.x() << nl
@@ -125,9 +125,9 @@ int main(int argc, char *argv[])
         Info<< "Rotating points by quaternion " << R << endl;
         points = transform(R, points);
     }
-    else if (args.options().found("yawPitchRoll"))
+    else if (args.optionFound("yawPitchRoll"))
     {
-        vector v(IStringStream(args.options()["yawPitchRoll"])());
+        vector v(args.optionLookup("yawPitchRoll")());
 
         Info<< "Rotating points by" << nl
             << "    yaw   " << v.x() << nl
@@ -150,9 +150,9 @@ int main(int argc, char *argv[])
         points = transform(R, points);
     }
 
-    if (args.options().found("scale"))
+    if (args.optionFound("scale"))
     {
-        vector scaleVector(IStringStream(args.options()["scale"])());
+        vector scaleVector(args.optionLookup("scale")());
 
         Info<< "Scaling points by " << scaleVector << endl;
 
diff --git a/bin/buildParaView3.5-cvs b/bin/buildParaView
similarity index 72%
rename from bin/buildParaView3.5-cvs
rename to bin/buildParaView
index f12a158973f9ac6c4191f515e333787a8cf64488..76a0264e69baefe1b5503212a49297ccba5c9d4d 100755
--- a/bin/buildParaView3.5-cvs
+++ b/bin/buildParaView
@@ -24,38 +24,38 @@
 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 #
 # Script
-#     buildParaView3.5-cvs
+#     buildParaView
 #
 # Description
-#     Build and install ParaView
-#     - run from folder above ParaView source folder or place the
-#       ParaView source under $WM_THIRD_PARTY_DIR
+#     Build and install paraview
+#     - run from folder above paraview source folder or place the
+#       paraview source under $WM_THIRD_PARTY_DIR
 #
 #------------------------------------------------------------------------------
 . $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions
 
-PARAVIEW_SRC=paraview-3.5-cvs
-PARAVIEW_MAJOR_VERSION=3.5
-
 # User options:
 # ~~~~~~~~~~~~~
 
 # MPI support:
-WITH_MPI=OFF
+withMPI=false
 MPI_MAX_PROCS=32
 
 # Python support:
 # note: script will try to determine the appropriate python library.
 #       If it fails, specify the path using the PYTHON_LIBRARY variable
-WITH_PYTHON=OFF
+withPYTHON=false
 PYTHON_LIBRARY=""
-# PYTHON_LIBRARY="/usr/lib64/libpython2.5.so.1.0"
+# PYTHON_LIBRARY="/usr/lib64/libpython2.6.so.1.0"
 
 # MESA graphics support:
-WITH_MESA=OFF
-MESA_INCLUDE_DIR="/usr/include/GL"
+withMESA=false
+MESA_INCLUDE="/usr/include/GL"
 MESA_LIBRARY="/usr/lib64/libOSMesa.so"
 
+# extra QT gui support (useful for re-using the installation for engrid)
+withQTSUPPORT=true
+
 #
 # No further editing below this line
 #------------------------------------------------------------------------------
@@ -65,13 +65,15 @@ usage() {
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
     cat<<USAGE
 
-usage: ${0##*/} [OPTION]
+usage: $Script [OPTION]
 options:
-  -fast      for repeated builds (-make -install) *use with caution*
-  -mpi       with mpi (if not already enabled)
-  -python    with python (if not already enabled)
-  -mesa      with mesa (if not already enabled)
-  -verbose   verbose output in Makefiles
+  -rebuild      for repeated builds (-make -install) *use with caution*
+  -mpi          with mpi (if not already enabled)
+  -python       with python (if not already enabled)
+  -mesa         with mesa (if not already enabled)
+  -qt           with extra Qt gui support (if not already enabled)
+  -verbose      verbose output in Makefiles
+  -version VER  specify an alternative version (default: $ParaView_VERSION)
   -help
 
 For finer control, the build stages can be also selected individually
@@ -82,25 +84,34 @@ For finer control, the build stages can be also selected individually
   -install
   [-envpath]    alter absolute paths in CMake files to use env variables
 
-Build and install $PARAVIEW_SRC
-  - run from folder above the ParaView source folder or place the
-    ParaView source under \$WM_THIRD_PARTY_DIR
+Build and install paraview-$ParaView_VERSION
+  - run from folder above the ParaView source folder or place the ParaView
+    source under \$WM_THIRD_PARTY_DIR ($WM_THIRD_PARTY_DIR)
 
 USAGE
    exit 1
 }
 
+#------------------------------------------------------------------------------
+
+#
 # add options based on script name:
-case "$Script" in *-mpi*)    WITH_MPI=ON;; esac
-case "$Script" in *-python*) WITH_PYTHON=ON;; esac
-case "$Script" in *-mesa*)   WITH_MESA=ON;; esac
+#
+case "$Script" in *-mpi*)    withMPI=true;; esac
+case "$Script" in *-python*) withPYTHON=true;; esac
+case "$Script" in *-mesa*)   withMESA=true;; esac
+case "$Script" in *-qt*)     withQTSUPPORT=true;; esac
 
+#
+# various building stages
+#
 runCONFIG=true
 runMAKE=true
 runMAKEDOC=true
 runINSTALL=true
 runENVPATH=false
 
+
 # parse options
 while [ "$#" -gt 0 ]
 do
@@ -144,7 +155,7 @@ do
         runENVPATH=true
         shift
         ;;
-    -fast)               # shortcut for rebuild
+    -rebuild)            # shortcut for rebuilding
         runCONFIG=false
         runMAKE=true
         runMAKEDOC=false
@@ -152,36 +163,48 @@ do
         shift
         ;;
     -mpi)
-        WITH_MPI=ON
+        withMPI=true
         shift
         ;;
     -python)
-        WITH_PYTHON=ON
+        withPYTHON=true
         shift
         ;;
     -mesa)
-        WITH_MESA=ON
+        withMESA=true
+        shift
+        ;;
+    -qt)
+        withQTSUPPORT=true
         shift
         ;;
     -verbose)
-        VERBOSE=ON
+        withVERBOSE=true
         shift
         ;;
+    -version)
+        [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
+        export ParaView_VERSION=$2
+        shift 2
+        ;;
     *)
         usage "unknown option/argument: '$*'"
         ;;
     esac
 done
 
+
 # Set configure options
 #~~~~~~~~~~~~~~~~~~~~~~
 addVerbosity        # verbose makefiles
 addMpiSupport       # set MPI-specific options
 addPythonSupport    # set Python-specific options
 addMesaSupport      # set MESA-specific options
+addQtSupport        # add extra Qt support
 
 getPaths            # discover where things are or should be put
 
+
 # Build and install
 # ~~~~~~~~~~~~~~~~~
 [ $runCONFIG  = true ] && configParaView
diff --git a/bin/buildParaView-python b/bin/buildParaView-python
new file mode 120000
index 0000000000000000000000000000000000000000..5c6464acd1fcec5a62526fe789df17e6d3ac8df6
--- /dev/null
+++ b/bin/buildParaView-python
@@ -0,0 +1 @@
+buildParaView
\ No newline at end of file
diff --git a/bin/buildParaView3.5-cvs-python b/bin/buildParaView3.5-cvs-python
deleted file mode 120000
index d3ed3924a892abffc145149dd53de0b9819d6272..0000000000000000000000000000000000000000
--- a/bin/buildParaView3.5-cvs-python
+++ /dev/null
@@ -1 +0,0 @@
-buildParaView3.5-cvs
\ No newline at end of file
diff --git a/bin/engridFoam b/bin/engridFoam
new file mode 100755
index 0000000000000000000000000000000000000000..37e61b05691b7709878d8c647bcb0634e17334a4
--- /dev/null
+++ b/bin/engridFoam
@@ -0,0 +1,66 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# =========                 |
+# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+#  \\    /   O peration     |
+#   \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
+#    \\/     M anipulation  |
+#-------------------------------------------------------------------------------
+# License
+#     This file is part of OpenFOAM.
+#
+#     OpenFOAM is free software; you can redistribute it and/or modify it
+#     under the terms of the GNU General Public License as published by the
+#     Free Software Foundation; either version 2 of the License, or (at your
+#     option) any later version.
+#
+#     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+#     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#     for more details.
+#
+#     You should have received a copy of the GNU General Public License
+#     along with OpenFOAM; if not, write to the Free Software Foundation,
+#     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Script
+#     engridFoam
+#
+# Description
+#     start engrid using the paraview libraries from OpenFOAM
+#
+#------------------------------------------------------------------------------
+usage() {
+    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
+    cat<<USAGE
+
+usage: ${0##*/} [OPTION]
+options:
+  -help
+
+* start engrid using the paraview-$ParaView_VERSION libraries
+  passes through engrid options unmodified
+
+USAGE
+    exit 1
+}
+
+# report usage
+[ "$1" = "-h" -o "$1" = "-help" ] && usage
+
+# set the major version "<digits>.<digits>"
+ParaView_MAJOR_VERSION=$(echo $ParaView_VERSION | \
+    sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/')
+
+
+bindir=$WM_THIRD_PARTY_DIR/engrid/platforms/$WM_ARCH
+libdir="$ParaView_DIR/lib/paraview-$ParaView_MAJOR_VERSION"
+
+[ -x $bindir/engrid ] || usage "engrid executable not found in $bindir"
+[ -d $libdir ] || usage "paraview libraries not found"
+
+export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
+echo "starting $bindir/engrid $@"
+eval "exec $bindir/engrid $@ &"
+
+#------------------------------------------------------------------------------
diff --git a/bin/tools/buildParaView3.4 b/bin/tools/buildParaView3.4
deleted file mode 100755
index ebdaae111f771bdb9f774817dc04dd0af9fbf279..0000000000000000000000000000000000000000
--- a/bin/tools/buildParaView3.4
+++ /dev/null
@@ -1,192 +0,0 @@
-#!/bin/sh
-#------------------------------------------------------------------------------
-# =========                 |
-# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-#  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
-#    \\/     M anipulation  |
-#------------------------------------------------------------------------------
-# License
-#     This file is part of OpenFOAM.
-#
-#     OpenFOAM is free software; you can redistribute it and/or modify it
-#     under the terms of the GNU General Public License as published by the
-#     Free Software Foundation; either version 2 of the License, or (at your
-#     option) any later version.
-#
-#     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-#     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-#     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-#     for more details.
-#
-#     You should have received a copy of the GNU General Public License
-#     along with OpenFOAM; if not, write to the Free Software Foundation,
-#     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Script
-#     buildParaView3.3-cvs
-#
-# Description
-#     Build and install ParaView
-#     - run from folder above ParaView source folder or place the
-#       ParaView source under $WM_THIRD_PARTY_DIR
-#
-#------------------------------------------------------------------------------
-. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions
-
-PARAVIEW_SRC=paraview-3.4
-PARAVIEW_MAJOR_VERSION=3.4
-
-# User options:
-# ~~~~~~~~~~~~~
-
-# MPI support:
-WITH_MPI=OFF
-MPI_MAX_PROCS=32
-
-# Python support:
-# note: script will try to determine the appropriate python library.
-#       If it fails, specify the path using the PYTHON_LIBRARY variable
-WITH_PYTHON=OFF
-PYTHON_LIBRARY=""
-# PYTHON_LIBRARY="/usr/lib64/libpython2.5.so.1.0"
-
-# MESA graphics support:
-WITH_MESA=OFF
-
-#
-# No further editing below this line
-#------------------------------------------------------------------------------
-Script=${0##*/}
-
-usage() {
-    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
-    cat<<USAGE
-
-usage: ${0##*/} [OPTION]
-options:
-  -fast      for repeated builds (-make -install) *use with caution*
-  -mpi       with mpi (if not already enabled)
-  -python    with python (if not already enabled)
-  -mesa      with mesa (if not already enabled)
-  -verbose   verbose output in Makefiles
-  -help
-
-For finer control, the build stages can be also selected individually
-(mutually exclusive)
-  -config
-  -make
-  -makedoc
-  -install
-  [-envpath]    alter absolute paths in CMake files to use env variables
-
-Build and install $PARAVIEW_SRC
-  - run from folder above the ParaView source folder or place the
-    ParaView source under \$WM_THIRD_PARTY_DIR
-
-USAGE
-   exit 1
-}
-
-# add options based on script name:
-case "$Script" in *-mpi*)    WITH_MPI=ON;; esac
-case "$Script" in *-python*) WITH_PYTHON=ON;; esac
-case "$Script" in *-mesa*)   WITH_MESA=ON;; esac
-
-runCONFIG=true
-runMAKE=true
-runMAKEDOC=true
-runINSTALL=true
-runENVPATH=false
-
-# parse options
-while [ "$#" -gt 0 ]
-do
-    case "$1" in
-    -h | -help)
-        usage
-        ;;
-    -config)             # stage 1: config only
-        runCONFIG=true
-        runMAKE=false
-        runMAKEDOC=false
-        runINSTALL=false
-        shift
-        ;;
-    -make)               # stage 2: make only
-        runCONFIG=false
-        runMAKE=true
-        runMAKEDOC=false
-        runINSTALL=false
-        shift
-        ;;
-    -makedoc)            # stage 3: generate html documentation
-        runCONFIG=false
-        runMAKE=false
-        runMAKEDOC=true
-        runINSTALL=false
-        shift
-        ;;
-    -install)            # stage 4: install only
-        runCONFIG=false
-        runMAKE=false
-        runMAKEDOC=false
-        runINSTALL=true
-        shift
-        ;;
-    -envpath)            # optional: change cmake files to use env variables
-        runCONFIG=false
-        runMAKE=false
-        runMAKEDOC=false
-        runINSTALL=false
-        runENVPATH=true
-        shift
-        ;;
-    -fast)               # shortcut for rebuild
-        runCONFIG=false
-        runMAKE=true
-        runMAKEDOC=false
-        runINSTALL=true
-        shift
-        ;;
-    -mpi)
-        WITH_MPI=ON
-        shift
-        ;;
-    -python)
-        WITH_PYTHON=ON
-        shift
-        ;;
-    -mesa)
-        WITH_MESA=ON
-        shift
-        ;;
-    -verbose)
-        VERBOSE=ON
-        shift
-        ;;
-    *)
-        usage "unknown option/argument: '$*'"
-        ;;
-    esac
-done
-
-# Set configure options
-#~~~~~~~~~~~~~~~~~~~~~~
-addVerbosity        # verbose makefiles
-addMpiSupport       # set MPI-specific options
-addPythonSupport    # set Python-specific options
-addMesaSupport      # set MESA-specific options
-
-getPaths            # discover where things are or should be put
-
-# Build and install
-# ~~~~~~~~~~~~~~~~~
-[ $runCONFIG  = true ] && configParaView
-[ $runMAKE    = true ] && makeParaView
-[ $runENVPATH = true ] && fixCMakeFiles
-[ $runMAKEDOC = true ] && makeDocs
-[ $runINSTALL = true ] && installParaView
-
-echo "done"
-#------------------------------------------------------------------------------
diff --git a/bin/tools/buildParaViewFunctions b/bin/tools/buildParaViewFunctions
index f1da2c0e3e23f87cf17c380e056d71a90e07ae83..f1c6ffaed6992ccae240f0f48df33ef742d59c3c 100644
--- a/bin/tools/buildParaViewFunctions
+++ b/bin/tools/buildParaViewFunctions
@@ -53,7 +53,7 @@ addCMakeVariable()
 #
 addVerbosity()
 {
-    [ "$VERBOSE" = ON ] && addCMakeVariable  CMAKE_VERBOSE_MAKEFILE=TRUE
+    [ "$withVERBOSE" = true ] && addCMakeVariable  CMAKE_VERBOSE_MAKEFILE=TRUE
 }
 
 
@@ -62,7 +62,7 @@ addVerbosity()
 #
 addMpiSupport()
 {
-    [ "$WITH_MPI" = ON ] || return
+    [ "${withMPI:=false}" = true ] || return
     OBJ_ADD="$OBJ_ADD-mpi"
 
     addCMakeVariable  PARAVIEW_USE_MPI=ON VTK_USE_MPI=ON
@@ -78,7 +78,7 @@ addMpiSupport()
 #
 addPythonSupport()
 {
-    [ "$WITH_PYTHON" = ON ] || return
+    [ "${withPYTHON:=false}" = true ] || return
     OBJ_ADD="$OBJ_ADD-py"
 
     if pythonBin=$(which python 2>/dev/null)
@@ -105,25 +105,18 @@ addPythonSupport()
         [ -e "$PYTHON_LIBRARY" ] || {
             echo "    Please set the variable PYTHON_LIBRARY to the full"
             echo "    path to (and including) libpython, or deactivate"
-            echo "    python support by setting WITH_PYTHON=OFF"
+            echo "    python support by setting withPYTHON=false"
             exit 1
         }
 
         pythonMajor=$(echo $PYTHON_LIBRARY | sed 's/.*libpython\(.*\)\.so.*/\1/')
         pythonInclude=/usr/include/python$pythonMajor
 
-        [ -e "$PYTHON_LIBRARY" ] || {
-            echo "    Please set the variable PYTHON_LIBRARY to the full"
-            echo "    path to (and including) libpython, or deactivate"
-            echo "    python support by setting WITH_PYTHON=OFF"
-            exit 1
-        }
-
         # note - we could also allow for a PYTHON_INCLUDE variable ...
-        [ -e "$pythonInclude" ] || {
-            echo "    No python include headers found"
+        [ -d "$pythonInclude" ] || {
+            echo "    No python headers found in $pythonInclude/"
             echo "    Please install python headers or deactivate "
-            echo "    python support by setting WITH_PYTHON=OFF"
+            echo "    python support by setting withPYTHON=false"
             exit 1
         }
 
@@ -140,8 +133,8 @@ addPythonSupport()
 
         unset pythonBin pythonInclude pythonMajor
     else
-        echo "*** Error: python not installed"
-        echo "***        Deactivate python support by setting WITH_PYTHON=OFF"
+        echo "*** Error: python not found"
+        echo "***        Deactivate python support by setting withPYTHON=false"
         exit 1
     fi
 }
@@ -152,26 +145,33 @@ addPythonSupport()
 #
 addMesaSupport()
 {
-    [ "$WITH_MESA" = ON ] || return
+    [ "${withMESA:=false}" = true ] || return
 
-    if [ -d "$MESA_INCLUDE_DIR" -a -f "$MESA_LIBRARY" ]
+    if [ -d "$MESA_INCLUDE" -a -f "$MESA_LIBRARY" ]
     then
         OBJ_ADD="$OBJ_ADD-mesa"
 
         addCMakeVariable  VTK_OPENGL_HAS_OSMESA=ON
-        addCMakeVariable  OSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR
+        addCMakeVariable  OSMESA_INCLUDE_DIR=$MESA_INCLUDE
         addCMakeVariable  OSMESA_LIBRARY=$MESA_LIBRARY
 
     else
        echo "*** Error: no MESA information found"
-       echo "***        Deactivate MESA support by setting WITH_MESA=OFF, or"
-       echo "***        correct paths given by:"
-       echo "***        - MESA_INCLUDE_DIR ($MESA_INCLUDE_DIR)"
+       echo "***        Deactivate MESA support by setting withMESA=false, or"
+       echo "***        correct the paths given by:"
+       echo "***        - MESA_INCLUDE ($MESA_INCLUDE)"
        echo "***        - MESA_LIBRARY ($MESA_LIBRARY)"
        exit 1
     fi
 }
 
+addQtSupport()
+{
+    [ "${withQTSUPPORT:=false}" = true ] || return
+
+    addCMakeVariable "PARAVIEW_BUILD_QT_GUI=ON"
+}
+
 
 #
 # discover where things are or should be put
@@ -181,24 +181,32 @@ getPaths()
     # set paraview environment
     for i in $PWD $WM_THIRD_PARTY_DIR
     do
-        ParaView_INST_DIR=$i/$PARAVIEW_SRC
+        ParaView_INST_DIR=$i/paraview-$ParaView_VERSION
         [ -d $ParaView_INST_DIR ] && break
     done
 
     if [ ! -d "$ParaView_INST_DIR" ]
     then
         # last chance: maybe already in the paraview directory
-        [ "${PWD##*/}" = $PARAVIEW_SRC ] && ParaView_INST_DIR=$PWD
+        if [ "${PWD##*/}" = "paraview-$ParaView_VERSION" ]
+        then
+            ParaView_INST_DIR=$PWD
+        fi
 
         [ -d "$ParaView_INST_DIR" ] || {
-            echo "did not find $PARAVIEW_SRC in these directories:"
+            echo "did not find paraview-$ParaView_VERSION in these directories:"
             echo "  PWD=$PWD"
             echo "  WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR"
+            echo
             echo "abort build"
             exit 1
         }
     fi
 
+    # set the major version "<digits>.<digits>"
+    ParaView_MAJOR_VERSION=$(echo $ParaView_VERSION | \
+        sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/')
+
     # ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER$OBJ_ADD
     ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER
     echo "ParaView_DIR=$ParaView_DIR"
@@ -221,10 +229,11 @@ configParaView()
     cd $ParaView_DIR
 
     echo "----"
-    echo "Configuring $PARAVIEW_SRC"
-    echo "    MPI support    : $WITH_MPI"
-    echo "    Python support : $WITH_PYTHON"
-    echo "    MESA support   : $WITH_MESA"
+    echo "Configuring paraview-$ParaView_VERSION (major version: $ParaView_MAJOR_VERSION)"
+    echo "    MPI    support : ${withMPI:-false}"
+    echo "    Python support : ${withPYTHON:-false}"
+    echo "    MESA   support : ${withMESA:-false}"
+    echo "    Qt dev support : ${withQTSUPPORT:-false}"
     echo "    Source         : $ParaView_INST_DIR"
     echo "    Target         : $ParaView_DIR"
     echo "----"
@@ -266,10 +275,10 @@ makeParaView()
     fi
     echo "    Done make"
 
-    echo "    For quicker development, linking lib/paraview-$PARAVIEW_MAJOR_VERSION/ -> bin/"
-    rm -rf lib/paraview-$PARAVIEW_MAJOR_VERSION
+    echo "    For quicker development, linking lib/paraview-$ParaView_MAJOR_VERSION/ -> bin/"
+    rm -rf lib/paraview-$ParaView_MAJOR_VERSION
     mkdir lib 2>/dev/null
-    ( cd lib && ln -s ../bin paraview-$PARAVIEW_MAJOR_VERSION )
+    ( cd lib && ln -s ../bin paraview-$ParaView_MAJOR_VERSION )
 }
 
 
@@ -317,7 +326,7 @@ fixCMakeFiles()
     fixHardLinks ParaView_INST_DIR "$ParaView_INST_DIR" '*.cmake'
 
     # Replace path with env variable: MPI_ARCH_PATH
-    if [ "$WITH_MPI" = ON ]
+    if [ "${withMPI:=false}" = true ]
     then
         fixHardLinks MPI_ARCH_PATH "$MPI_ARCH_PATH" '*.cmake'
     fi
@@ -359,10 +368,10 @@ installParaView()
     echo "disabled 'make install' for now, just use links"
 
     # about.txt may be missing
-    paraviewLibDir="$ParaView_DIR/lib/paraview-$PARAVIEW_MAJOR_VERSION"
+    paraviewLibDir="$ParaView_DIR/lib/paraview-$ParaView_MAJOR_VERSION"
     if [ -d "$paraviewLibDir" -a ! -e "$paraviewLibDir/about.txt" ]
     then
-        echo "paraview-$PARAVIEW_MAJOR_VERSION installed - $(date)" > $paraviewLibDir/about.txt
+        echo "paraview-$ParaView_MAJOR_VERSION installed - $(date)" > $paraviewLibDir/about.txt
     fi
 
 cat<< INFO
@@ -380,9 +389,9 @@ INFO
 
 
 # clear all the variables used before using any of the functions
-unset VERBOSE
-unset WITH_MPI WITH_MESA
-unset WITH_PYTHON PYTHON_LIBRARY
+unset withMPI withQTSUPPORT withVERBOSE
+unset withMESA   MESA_INCLUDE   MESA_LIBRARY
+unset withPYTHON PYTHON_INCLUDE PYTHON_LIBRARY
 unset CMAKE_VARIABLES
 unset OBJ_ADD
 
diff --git a/etc/aliases.csh b/etc/aliases.csh
index a86caa89ef7e7475f4ed1bc625e7b11e166dbf07..fd7f183a368a39d2d60c7ba5d758bbc1af03a0f5 100644
--- a/etc/aliases.csh
+++ b/etc/aliases.csh
@@ -56,5 +56,6 @@ alias app 'cd $FOAM_APP'
 alias util 'cd $FOAM_UTILITIES'
 alias sol 'cd $FOAM_SOLVERS'
 alias tut 'cd $FOAM_TUTORIALS'
+alias foam3rdParty 'cd $WM_THIRD_PARTY_DIR'
 
 # -----------------------------------------------------------------------------
diff --git a/etc/aliases.sh b/etc/aliases.sh
index a1d8685ba6ebc6b5e920086163c44e67ecbdfa07..b193802246982261a6a18ade4442d2ed3cd5f036 100644
--- a/etc/aliases.sh
+++ b/etc/aliases.sh
@@ -56,5 +56,6 @@ alias app='cd $FOAM_APP'
 alias util='cd $FOAM_UTILITIES'
 alias sol='cd $FOAM_SOLVERS'
 alias tut='cd $FOAM_TUTORIALS'
+alias foam3rdParty='cd $WM_THIRD_PARTY_DIR'
 
 # -----------------------------------------------------------------------------
diff --git a/etc/apps/cint/bashrc b/etc/apps/cint/bashrc
index 3ecfd85517b82d881e94f18266f47c1e09e09148..dbbd89631e2487e11803e1dea7cb95a720e0aafc 100644
--- a/etc/apps/cint/bashrc
+++ b/etc/apps/cint/bashrc
@@ -27,7 +27,7 @@
 #
 # Description
 #     Setup file for cint
-#     Sourced from OpenFOAM-?.?/etc/bashrc
+#     Sourced from OpenFOAM-*/etc/bashrc
 #
 #------------------------------------------------------------------------------
 
diff --git a/etc/apps/cint/cshrc b/etc/apps/cint/cshrc
index 6807b32a3d61eb77fba6841792828aae245d0d9b..f2c38c481a3ebca703415c4e094137bb8efc43db 100644
--- a/etc/apps/cint/cshrc
+++ b/etc/apps/cint/cshrc
@@ -26,8 +26,8 @@
 #     cint/cshrc
 #
 # Description
-#     Startup File for cint
-#     Sourced from OpenFOAM-?.?/etc/cshrc
+#     Setup file for cint
+#     Sourced from OpenFOAM-*/etc/cshrc
 #
 #------------------------------------------------------------------------------
 
diff --git a/etc/apps/ensight/bashrc b/etc/apps/ensight/bashrc
index ffd07ab71de68d35d3a75254b3e04bc31f0de2ee..100f65ae5db4efe53a673d032fddef3d74bc3241 100644
--- a/etc/apps/ensight/bashrc
+++ b/etc/apps/ensight/bashrc
@@ -23,11 +23,11 @@
 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 #
 # Script
-#     ensightFoam/bashrc
+#     ensight/bashrc
 #
 # Description
 #     Setup file for Ensight 8.?
-#     Sourced from OpenFOAM-?.?/etc/bashrc
+#     Sourced from OpenFOAM-*/etc/bashrc
 #
 #------------------------------------------------------------------------------
 
diff --git a/etc/apps/ensight/cshrc b/etc/apps/ensight/cshrc
index 52335c6b56de79f98b67cf91cf83c3badb90722b..ae7f3d6095763ddbbfd56fdae6023007d67115c2 100644
--- a/etc/apps/ensight/cshrc
+++ b/etc/apps/ensight/cshrc
@@ -23,11 +23,11 @@
 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 #
 # Script
-#     ensightFoam/cshrc
+#     ensight/cshrc
 #
 # Description
-#     Startup File for Ensight 8.?.
-#     Sourced from OpenFOAM-?.?/etc/cshrc
+#     Setup file for Ensight 8.?
+#     Sourced from OpenFOAM-*/etc/cshrc
 #
 #------------------------------------------------------------------------------
 
diff --git a/etc/apps/paraview/bashrc b/etc/apps/paraview/bashrc
index f31ec9058a6780e8ff14eaa83dfcb25b051303f5..a6e2c08051a3db1fcb293cdfec30f56116d51909 100644
--- a/etc/apps/paraview/bashrc
+++ b/etc/apps/paraview/bashrc
@@ -26,22 +26,29 @@
 #     paraview/bashrc
 #
 # Description
-#     Setup file for Paraview.
-#     Sourced from OpenFOAM-?.?/etc/bashrc
+#     Setup file for paraview-2.x
+#     Sourced from OpenFOAM-*/etc/bashrc
 #
 #------------------------------------------------------------------------------
 
-export CMAKE_HOME=$WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
-
-if [ -r $CMAKE_HOME ]
-then
-    export PATH=$CMAKE_HOME/bin:$PATH
-fi
+# determine the cmake to be used
+unset CMAKE_HOME
+for cmake in cmake-2.6.4 cmake-2.6.2 cmake-2.4.6
+do
+    cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH
+    if [ -r $cmake ]
+    then
+        export CMAKE_HOME=$cmake
+        export PATH=$CMAKE_HOME/bin:$PATH
+        break
+    fi
+done
 
+paraviewMajor=paraview-2.4
 export ParaView_VERSION=2.4.4
 
 export ParaView_INST_DIR=$WM_THIRD_PARTY_DIR/ParaView$ParaView_VERSION
-export ParaView_DIR=$ParaView_INST_DIR/lib/paraview-2.4
+export ParaView_DIR=$ParaView_INST_DIR/lib/$paraviewMajor
 
 if [ -r $ParaView_INST_DIR ]
 then
@@ -56,4 +63,5 @@ then
     export VTK_DIR=$ParaView_DIR/VTK
 fi
 
+unset cmake paraviewMajor
 # -----------------------------------------------------------------------------
diff --git a/etc/apps/paraview/cshrc b/etc/apps/paraview/cshrc
index 130efc110285c88afafda273390f47d4d1441233..a1552a511686013ff9eef29b79d8153a07e9448d 100644
--- a/etc/apps/paraview/cshrc
+++ b/etc/apps/paraview/cshrc
@@ -26,21 +26,27 @@
 #     paraview/cshrc
 #
 # Description
-#     Startup File for Paraview.
-#     Sourced from OpenFOAM-?.?/etc/cshrc
+#     Setup file for paraview-2.x
+#     Sourced from OpenFOAM-*/etc/cshrc
 #
 #------------------------------------------------------------------------------
 
-setenv CMAKE_HOME $WM_THIRD_PARTY_DIR/cmake-2.4.6/platforms/$WM_ARCH
-
-if ( -r $CMAKE_HOME ) then
-    set path=($CMAKE_HOME/bin $path)
-endif
-
+# determine the cmake to be used
+unsetenv CMAKE_HOME
+foreach cmake ( cmake-2.6.4 cmake-2.6.2 cmake-2.4.6 )
+    set cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH
+    if ( -r $cmake ) then
+        setenv CMAKE_HOME $cmake
+        set path=($CMAKE_HOME/bin $path)
+        break
+    endif
+end
+
+set paraviewMajor=paraview-2.4
 setenv ParaView_VERSION 2.4.4
 
 setenv ParaView_INST_DIR $WM_THIRD_PARTY_DIR/ParaView$ParaView_VERSION
-setenv ParaView_DIR $ParaView_INST_DIR/lib/paraview-2.4
+setenv ParaView_DIR $ParaView_INST_DIR/lib/$paraviewMajor
 
 if ( -r $ParaView_INST_DIR ) then
     setenv PV_INTERFACE_PATH $FOAM_UTILITIES/postProcessing/graphics/PVFoamReader/PVFoamReader/Make
@@ -53,4 +59,5 @@ if ( -r $ParaView_DIR ) then
     setenv VTK_DIR $ParaView_DIR/VTK
 endif
 
+unset cmake paraviewMajor
 # -----------------------------------------------------------------------------
diff --git a/etc/apps/paraview3/bashrc b/etc/apps/paraview3/bashrc
index 2120bf5d562175e2aee7035fd62ef05c1c0405e7..f49288b36ec26ad2c712a9f824cfd5b3ddc4a9ce 100644
--- a/etc/apps/paraview3/bashrc
+++ b/etc/apps/paraview3/bashrc
@@ -27,7 +27,7 @@
 #
 # Description
 #     Setup file for paraview-3.x
-#     Sourced from OpenFOAM-?.?/etc/bashrc
+#     Sourced from OpenFOAM-*/etc/bashrc
 #
 # Note
 #     The env. variable 'ParaView_DIR' is required for building plugins
@@ -35,7 +35,7 @@
 
 # determine the cmake to be used
 unset CMAKE_HOME
-for cmake in cmake-2.6.2 cmake-2.4.6
+for cmake in cmake-2.6.4 cmake-2.6.2 cmake-2.4.6
 do
     cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH
     if [ -r $cmake ]
diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc
index 5ad99a1030d0b7ab8c6506418c94ce9951504d5d..1c500f4962544271b887b812dff67f268cf89c04 100644
--- a/etc/apps/paraview3/cshrc
+++ b/etc/apps/paraview3/cshrc
@@ -26,8 +26,8 @@
 #     paraview3/cshrc
 #
 # Description
-#     Startup File for paraview-3.x
-#     Sourced from OpenFOAM-?.?/etc/cshrc
+#     Setup file for paraview-3.x
+#     Sourced from OpenFOAM-*/etc/cshrc
 #
 # Note
 #     The env. variable 'ParaView_DIR' is required for building plugins
@@ -35,7 +35,7 @@
 
 # determine the cmake to be used
 unsetenv CMAKE_HOME
-foreach cmake ( cmake-2.6.2 cmake-2.4.6 )
+foreach cmake ( cmake-2.6.4 cmake-2.6.2 cmake-2.4.6 )
     set cmake=$WM_THIRD_PARTY_DIR/$cmake/platforms/$WM_ARCH
     if ( -r $cmake ) then
         setenv CMAKE_HOME $cmake
diff --git a/etc/bashrc b/etc/bashrc
index 17b84d853dc46279ca47ed173396bddac19c22b6..edd0265b63d079bec3730a3be43a72878b692d6c 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -79,8 +79,8 @@ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty
 
 # Operating System/Platform
 # ~~~~~~~~~~~~~~~~~~~~~~~~~
-# WM_OS = Unix | ????
-: ${WM_OS:=Unix}; export WM_OS
+# WM_OSTYPE = POSIX | ????
+: ${WM_OSTYPE:=POSIX}; export WM_OSTYPE
 
 
 # Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc)
diff --git a/etc/controlDict b/etc/controlDict
index 65058af1a6c6a324f826be3d8b22ec9425195b96..c5f3831a30c143a6b1ee1fabf780c353080e8682 100644
--- a/etc/controlDict
+++ b/etc/controlDict
@@ -195,6 +195,7 @@ DebugSwitches
     PatchToPatchInterpolation 0;
     Phi                 0;
     PointEdgeWave       0;
+    POSIX               0;
     Prandtl             0;
     PrimitivePatch      0;
     Pstream             0;
@@ -249,7 +250,6 @@ DebugSwitches
     ThermoParcel<basicThermoParcel>     0;
     UMIST               0;
     UMISTV              0;
-    Unix                0;
     UpwindFitData<cubicUpwindFitPolynomial> 0;
     UpwindFitData<quadraticLinearUpwindFitPolynomial> 0;
     UpwindFitData<quadraticUpwindFitPolynomial>     0;
diff --git a/etc/cshrc b/etc/cshrc
index 0073521a339afff8ead4cd1286473aeb3002f6ad..17e75ba888df4e149d0d9bd52650d7e88a3bc482 100644
--- a/etc/cshrc
+++ b/etc/cshrc
@@ -73,8 +73,8 @@ setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty
 
 # Operating System/Platform
 # ~~~~~~~~~~~~~~~~~~~~~~~~~
-# WM_OS = Unix | ????
-if ( ! $?WM_OS ) setenv WM_OS Unix
+# WM_OSTYPE = POSIX | ????
+if ( ! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX
 
 
 # Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc)
diff --git a/src/Allwmake b/src/Allwmake
index 3168208c49f2dd8e10c591071fabcb5753e2115a..e374ba62e87a9e7921391501d38eb55dd941c4da 100755
--- a/src/Allwmake
+++ b/src/Allwmake
@@ -6,10 +6,10 @@ set -x
 wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/$WM_OPTIONS/global.? 2>/dev/null
 
 wmakeLnInclude -f OpenFOAM
-wmakeLnInclude -f OSspecific/$WM_OS
+wmakeLnInclude -f OSspecific/$WM_OSTYPE
 Pstream/Allwmake
 
-wmake libo  OSspecific/$WM_OS
+wmake libo  OSspecific/$WM_OSTYPE
 wmake libso OpenFOAM
 
 wmake libso lagrangian/basic
diff --git a/src/OSspecific/Unix/Make/files b/src/OSspecific/POSIX/Make/files
similarity index 90%
rename from src/OSspecific/Unix/Make/files
rename to src/OSspecific/POSIX/Make/files
index b6e32d80d6652a96636c71d9ae129d35dd89035f..f6e7c2d55eda6f5ffbcc1f0de59451051b45d424 100644
--- a/src/OSspecific/Unix/Make/files
+++ b/src/OSspecific/POSIX/Make/files
@@ -5,14 +5,14 @@ signals/sigQuit.C
 regExp.C
 timer.C
 fileStat.C
-Unix.C
+POSIX.C
 cpuTime/cpuTime.C
 clockTime/clockTime.C
 
-#ifndef SunOS64
-printStack.C
-#else
+#ifdef SunOS64
 dummyPrintStack.C
+#else
+printStack.C
 #endif
 
 LIB = $(FOAM_LIBBIN)/libOSspecific
diff --git a/src/OSspecific/Unix/Make/options b/src/OSspecific/POSIX/Make/options
similarity index 100%
rename from src/OSspecific/Unix/Make/options
rename to src/OSspecific/POSIX/Make/options
diff --git a/src/OSspecific/Unix/Unix.C b/src/OSspecific/POSIX/POSIX.C
similarity index 98%
rename from src/OSspecific/Unix/Unix.C
rename to src/OSspecific/POSIX/POSIX.C
index 9378a21c7caacf345d715be1a1cdc20b6e33a9d1..09b3182b5208e5c55ea0731af06340cfa90853b4 100644
--- a/src/OSspecific/Unix/Unix.C
+++ b/src/OSspecific/POSIX/POSIX.C
@@ -23,7 +23,7 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Description
-    UNIX versions of the functions declared in OSspecific.H
+    POSIX versions of the functions declared in OSspecific.H
 
 \*---------------------------------------------------------------------------*/
 
@@ -32,7 +32,7 @@ Description
 #endif
 
 #include "OSspecific.H"
-#include "Unix.H"
+#include "POSIX.H"
 #include "foamVersion.H"
 #include "fileName.H"
 #include "fileStat.H"
@@ -56,7 +56,7 @@ Description
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
-defineTypeNameAndDebug(Foam::Unix, 0);
+defineTypeNameAndDebug(Foam::POSIX, 0);
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
@@ -222,14 +222,14 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
     {
         // Check for user file in ~/.OpenFOAM/VERSION
         fileName fullName = searchDir/FOAMversion/name;
-        if (exists(fullName))
+        if (isFile(fullName))
         {
             return fullName;
         }
 
         // Check for version-independent user file in ~/.OpenFOAM
         fullName = searchDir/name;
-        if (exists(fullName))
+        if (isFile(fullName))
         {
             return fullName;
         }
@@ -243,14 +243,14 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
     {
         // Check for site file in $WM_PROJECT_INST_DIR/site/VERSION
         fileName fullName = searchDir/"site"/FOAMversion/name;
-        if (exists(fullName))
+        if (isFile(fullName))
         {
             return fullName;
         }
 
         // Check for version-independent site file in $WM_PROJECT_INST_DIR/site
         fullName = searchDir/"site"/name;
-        if (exists(fullName))
+        if (isFile(fullName))
         {
             return fullName;
         }
@@ -263,7 +263,7 @@ Foam::fileName Foam::findEtcFile(const fileName& name, bool mandatory)
     {
         // Check for shipped OpenFOAM file in $WM_PROJECT_DIR/etc
         fileName fullName = searchDir/"etc"/name;
-        if (exists(fullName))
+        if (isFile(fullName))
         {
             return fullName;
         }
@@ -536,7 +536,7 @@ Foam::fileNameList Foam::readDir
     // also used as increment if initial size found to be insufficient
     static const int maxNnames = 100;
 
-    if (Unix::debug)
+    if (POSIX::debug)
     {
         Info<< "readDir(const fileName&, const fileType, const bool filtergz)"
             << " : reading directory " << directory << endl;
@@ -557,7 +557,7 @@ Foam::fileNameList Foam::readDir
     {
         dirEntries.setSize(0);
 
-        if (Unix::debug)
+        if (POSIX::debug)
         {
             Info<< "readDir(const fileName&, const fileType, "
                    "const bool filtergz) : cannot open directory "
@@ -690,7 +690,7 @@ bool Foam::cp(const fileName& src, const fileName& dest)
         fileNameList contents = readDir(src, fileName::FILE, false);
         forAll(contents, i)
         {
-            if (Unix::debug)
+            if (POSIX::debug)
             {
                 Info<< "Copying : " << src/contents[i]
                     << " to " << destFile/contents[i] << endl;
@@ -704,7 +704,7 @@ bool Foam::cp(const fileName& src, const fileName& dest)
         fileNameList subdirs = readDir(src, fileName::DIRECTORY);
         forAll(subdirs, i)
         {
-            if (Unix::debug)
+            if (POSIX::debug)
             {
                 Info<< "Copying : " << src/subdirs[i]
                     << " to " << destFile << endl;
@@ -722,7 +722,7 @@ bool Foam::cp(const fileName& src, const fileName& dest)
 // Create a softlink. dst should not exist. Returns true if successful.
 bool Foam::ln(const fileName& src, const fileName& dst)
 {
-    if (Unix::debug)
+    if (POSIX::debug)
     {
         Info<< "Create softlink from : " << src << " to " << dst
             << endl;
@@ -759,7 +759,7 @@ bool Foam::ln(const fileName& src, const fileName& dst)
 // Rename srcFile dstFile
 bool Foam::mv(const fileName& srcFile, const fileName& dstFile)
 {
-    if (Unix::debug)
+    if (POSIX::debug)
     {
         Info<< "Move : " << srcFile << " to " << dstFile << endl;
     }
@@ -784,7 +784,7 @@ bool Foam::mv(const fileName& srcFile, const fileName& dstFile)
 // Remove a file returning true if successful otherwise false
 bool Foam::rm(const fileName& file)
 {
-    if (Unix::debug)
+    if (POSIX::debug)
     {
         Info<< "Removing : " << file << endl;
     }
@@ -804,7 +804,7 @@ bool Foam::rm(const fileName& file)
 // Remove a dirctory and its contents
 bool Foam::rmDir(const fileName& directory)
 {
-    if (Unix::debug)
+    if (POSIX::debug)
     {
         Info<< "rmDir(const fileName&) : "
             << "removing directory " << directory << endl;
diff --git a/src/OSspecific/Unix/Unix.H b/src/OSspecific/POSIX/POSIX.H
similarity index 92%
rename from src/OSspecific/Unix/Unix.H
rename to src/OSspecific/POSIX/POSIX.H
index 97e5d21de2f05d0396d47b7e13baa8202b567f29..fde323b5ffee8158f80292be1c5f67a00b3678ef 100644
--- a/src/OSspecific/Unix/Unix.H
+++ b/src/OSspecific/POSIX/POSIX.H
@@ -23,18 +23,18 @@ License
     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 Namespace
-    Foam::Unix
+    Foam::POSIX
 
 Description
-    UNIX versions of OS-specific functions.
+    OS-specific functions implemented in POSIX.
 
 SourceFiles
-    Unix.C
+    POSIX.C
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef Unix_H
-#define Unix_H
+#ifndef POSIX_H
+#define POSIX_H
 
 #include "className.H"
 
@@ -45,10 +45,10 @@ namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
-namespace Unix
+namespace POSIX
 {
     //- Declare name of the class and its debug switch
-    NamespaceName("Unix");
+    NamespaceName("POSIX");
 }
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OSspecific/Unix/clockTime/clockTime.C b/src/OSspecific/POSIX/clockTime/clockTime.C
similarity index 100%
rename from src/OSspecific/Unix/clockTime/clockTime.C
rename to src/OSspecific/POSIX/clockTime/clockTime.C
diff --git a/src/OSspecific/Unix/clockTime/clockTime.H b/src/OSspecific/POSIX/clockTime/clockTime.H
similarity index 100%
rename from src/OSspecific/Unix/clockTime/clockTime.H
rename to src/OSspecific/POSIX/clockTime/clockTime.H
diff --git a/src/OSspecific/Unix/cpuTime/cpuTime.C b/src/OSspecific/POSIX/cpuTime/cpuTime.C
similarity index 100%
rename from src/OSspecific/Unix/cpuTime/cpuTime.C
rename to src/OSspecific/POSIX/cpuTime/cpuTime.C
diff --git a/src/OSspecific/Unix/cpuTime/cpuTime.H b/src/OSspecific/POSIX/cpuTime/cpuTime.H
similarity index 100%
rename from src/OSspecific/Unix/cpuTime/cpuTime.H
rename to src/OSspecific/POSIX/cpuTime/cpuTime.H
diff --git a/src/OSspecific/Unix/dummyPrintStack.C b/src/OSspecific/POSIX/dummyPrintStack.C
similarity index 100%
rename from src/OSspecific/Unix/dummyPrintStack.C
rename to src/OSspecific/POSIX/dummyPrintStack.C
diff --git a/src/OSspecific/Unix/fileStat.C b/src/OSspecific/POSIX/fileStat.C
similarity index 100%
rename from src/OSspecific/Unix/fileStat.C
rename to src/OSspecific/POSIX/fileStat.C
diff --git a/src/OSspecific/Unix/fileStat.H b/src/OSspecific/POSIX/fileStat.H
similarity index 100%
rename from src/OSspecific/Unix/fileStat.H
rename to src/OSspecific/POSIX/fileStat.H
diff --git a/src/OSspecific/Unix/printStack.C b/src/OSspecific/POSIX/printStack.C
similarity index 100%
rename from src/OSspecific/Unix/printStack.C
rename to src/OSspecific/POSIX/printStack.C
diff --git a/src/OSspecific/Unix/regExp.C b/src/OSspecific/POSIX/regExp.C
similarity index 100%
rename from src/OSspecific/Unix/regExp.C
rename to src/OSspecific/POSIX/regExp.C
diff --git a/src/OSspecific/Unix/regExp.H b/src/OSspecific/POSIX/regExp.H
similarity index 100%
rename from src/OSspecific/Unix/regExp.H
rename to src/OSspecific/POSIX/regExp.H
diff --git a/src/OSspecific/Unix/signals/sigFpe.C b/src/OSspecific/POSIX/signals/sigFpe.C
similarity index 100%
rename from src/OSspecific/Unix/signals/sigFpe.C
rename to src/OSspecific/POSIX/signals/sigFpe.C
diff --git a/src/OSspecific/Unix/signals/sigFpe.H b/src/OSspecific/POSIX/signals/sigFpe.H
similarity index 100%
rename from src/OSspecific/Unix/signals/sigFpe.H
rename to src/OSspecific/POSIX/signals/sigFpe.H
diff --git a/src/OSspecific/Unix/signals/sigInt.C b/src/OSspecific/POSIX/signals/sigInt.C
similarity index 100%
rename from src/OSspecific/Unix/signals/sigInt.C
rename to src/OSspecific/POSIX/signals/sigInt.C
diff --git a/src/OSspecific/Unix/signals/sigInt.H b/src/OSspecific/POSIX/signals/sigInt.H
similarity index 100%
rename from src/OSspecific/Unix/signals/sigInt.H
rename to src/OSspecific/POSIX/signals/sigInt.H
diff --git a/src/OSspecific/Unix/signals/sigQuit.C b/src/OSspecific/POSIX/signals/sigQuit.C
similarity index 100%
rename from src/OSspecific/Unix/signals/sigQuit.C
rename to src/OSspecific/POSIX/signals/sigQuit.C
diff --git a/src/OSspecific/Unix/signals/sigQuit.H b/src/OSspecific/POSIX/signals/sigQuit.H
similarity index 100%
rename from src/OSspecific/Unix/signals/sigQuit.H
rename to src/OSspecific/POSIX/signals/sigQuit.H
diff --git a/src/OSspecific/Unix/signals/sigSegv.C b/src/OSspecific/POSIX/signals/sigSegv.C
similarity index 100%
rename from src/OSspecific/Unix/signals/sigSegv.C
rename to src/OSspecific/POSIX/signals/sigSegv.C
diff --git a/src/OSspecific/Unix/signals/sigSegv.H b/src/OSspecific/POSIX/signals/sigSegv.H
similarity index 100%
rename from src/OSspecific/Unix/signals/sigSegv.H
rename to src/OSspecific/POSIX/signals/sigSegv.H
diff --git a/src/OSspecific/Unix/timer.C b/src/OSspecific/POSIX/timer.C
similarity index 100%
rename from src/OSspecific/Unix/timer.C
rename to src/OSspecific/POSIX/timer.C
diff --git a/src/OSspecific/Unix/timer.H b/src/OSspecific/POSIX/timer.H
similarity index 100%
rename from src/OSspecific/Unix/timer.H
rename to src/OSspecific/POSIX/timer.H
diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
index 826bb95741ba387d2cc86572119d1b3780020306..0e13b7c9a1d82016ff51b5915f09db97b6a42a64 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H
@@ -330,6 +330,9 @@ public:
                 inline T& operator*();
                 inline T& operator()();
 
+                inline const T& operator*() const;
+                inline const T& operator()() const;
+
                 inline iterator& operator++();
                 inline iterator operator++(int);
 
@@ -389,8 +392,8 @@ public:
                 inline bool operator==(const iterator&) const;
                 inline bool operator!=(const iterator&) const;
 
-                inline const T& operator*();
-                inline const T& operator()();
+                inline const T& operator*() const;
+                inline const T& operator()() const;
 
                 inline const_iterator& operator++();
                 inline const_iterator operator++(int);
diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H
index 005979df3f166a27ae3a91250cde1f81f5f55321..e2655da4334ea4878513b757d56d1133156b35b5 100644
--- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H
+++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H
@@ -220,16 +220,34 @@ inline bool Foam::HashTable<T, Key, Hash>::iterator::operator!=
 
 
 template<class T, class Key, class Hash>
-inline T& Foam::HashTable<T, Key, Hash>::iterator::operator*()
+inline T&
+Foam::HashTable<T, Key, Hash>::iterator::operator*()
 {
     return elmtPtr_->obj_;
 }
 
 
 template<class T, class Key, class Hash>
-inline T& Foam::HashTable<T, Key, Hash>::iterator::operator()()
+inline T&
+Foam::HashTable<T, Key, Hash>::iterator::operator()()
 {
-    return operator*();
+    return elmtPtr_->obj_;
+}
+
+
+template<class T, class Key, class Hash>
+inline const T&
+Foam::HashTable<T, Key, Hash>::iterator::operator*() const
+{
+    return elmtPtr_->obj_;
+}
+
+
+template<class T, class Key, class Hash>
+inline const T&
+Foam::HashTable<T, Key, Hash>::iterator::operator()() const
+{
+    return elmtPtr_->obj_;
 }
 
 
@@ -410,16 +428,18 @@ inline bool Foam::HashTable<T, Key, Hash>::const_iterator::operator!=
 
 
 template<class T, class Key, class Hash>
-inline const T& Foam::HashTable<T, Key, Hash>::const_iterator::operator*()
+inline const T& 
+Foam::HashTable<T, Key, Hash>::const_iterator::operator*() const
 {
     return elmtPtr_->obj_;
 }
 
 #ifndef __CINT__
 template<class T, class Key, class Hash>
-inline const T& Foam::HashTable<T, Key, Hash>::const_iterator::operator()()
+inline const T&
+Foam::HashTable<T, Key, Hash>::const_iterator::operator()() const
 {
-    return operator*();
+    return elmtPtr_->obj_;
 }
 #endif
 
diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H
index 639db9bbd20f62d1b66c32affcb5f0d268ad3631..434320cf5b21b980bbbbf286a57df2186e4e98fe 100644
--- a/src/OpenFOAM/containers/Lists/List/List.H
+++ b/src/OpenFOAM/containers/Lists/List/List.H
@@ -241,17 +241,27 @@ public:
 };
 
 
+//- Read a bracket-delimited list, or handle a single value as list of size 1.
+//  For example,
+//  @code
+//      wList = readList<word>(IStringStream("(patch1 patch2 patch3)")());
+//      wList = readList<word>(IStringStream("patch0")());
+//  @endcode
+//  Mostly useful for handling command-line arguments.
 template<class T>
-void sort(List<T>& a);
+List<T> readList(Istream&);
+
+template<class T>
+void sort(List<T>&);
 
 template<class T, class Cmp>
-void sort(List<T>& a, const Cmp&);
+void sort(List<T>&, const Cmp&);
 
 template<class T>
-void stableSort(List<T>& a);
+void stableSort(List<T>&);
 
 template<class T, class Cmp>
-void stableSort(List<T>& a, const Cmp&);
+void stableSort(List<T>&, const Cmp&);
 
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/containers/Lists/List/ListIO.C b/src/OpenFOAM/containers/Lists/List/ListIO.C
index d6238ae09108a455f29a28b070f05728d1adf098..2ba1d4f00e33205fd5fc3f891143cf79a0bdcc32 100644
--- a/src/OpenFOAM/containers/Lists/List/ListIO.C
+++ b/src/OpenFOAM/containers/Lists/List/ListIO.C
@@ -131,7 +131,7 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L)
         if (firstToken.pToken() != token::BEGIN_LIST)
         {
             FatalIOErrorIn("operator>>(Istream&, List<T>&)", is)
-                << "incorrect first token, expected '(' or '{', found "
+                << "incorrect first token, expected '(', found "
                 << firstToken.info()
                 << exit(FatalIOError);
         }
@@ -156,4 +156,37 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L)
     return is;
 }
 
+
+template<class T>
+Foam::List<T> Foam::readList(Istream& is)
+{
+    List<T> L;
+    token firstToken(is);
+    is.putBack(firstToken);
+
+    if (firstToken.isPunctuation())
+    {
+        if (firstToken.pToken() != token::BEGIN_LIST)
+        {
+            FatalIOErrorIn("readList<T>(Istream&)", is)
+                << "incorrect first token, expected '(', found "
+                << firstToken.info()
+                << exit(FatalIOError);
+        }
+
+        // read via a singly-linked list
+        L = SLList<T>(is);
+    }
+    else
+    {
+        // create list with a single item
+        L.setSize(1);
+
+        is >> L[0];
+    }
+
+    return L;
+}
+
+
 // ************************************************************************* //
diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C
index 0a3cbedc187b59c2dd02dacb156638662ea190d2..cc2c8e710da75ba158d1b8062a4ad508c50d57ee 100644
--- a/src/OpenFOAM/db/Time/Time.C
+++ b/src/OpenFOAM/db/Time/Time.C
@@ -109,20 +109,20 @@ void Foam::Time::setControls()
     else
     {
         // Search directory for valid time directories
-        instantList Times = findTimes(path());
+        instantList timeDirs = findTimes(path());
 
         if (startFrom == "firstTime")
         {
-            if (Times.size())
+            if (timeDirs.size())
             {
-                startTime_ = Times[0].value();
+                startTime_ = timeDirs[0].value();
             }
         }
         else if (startFrom == "latestTime")
         {
-            if (Times.size())
+            if (timeDirs.size())
             {
-                startTime_ = Times[Times.size()-1].value();
+                startTime_ = timeDirs[timeDirs.size()-1].value();
             }
         }
         else
@@ -385,13 +385,13 @@ Foam::instantList Foam::Time::times() const
 
 Foam::word Foam::Time::findInstancePath(const instant& t) const
 {
-    instantList times = Time::findTimes(path());
+    instantList timeDirs = findTimes(path());
 
-    forAllReverse(times, i)
+    forAllReverse(timeDirs, timeI)
     {
-        if (times[i] == t)
+        if (timeDirs[timeI] == t)
         {
-            return times[i].name();
+            return timeDirs[timeI].name();
         }
     }
 
@@ -401,37 +401,37 @@ Foam::word Foam::Time::findInstancePath(const instant& t) const
 
 Foam::instant Foam::Time::findClosestTime(const scalar t) const
 {
-    instantList times = Time::findTimes(path());
+    instantList timeDirs = findTimes(path());
 
-    // If there is only one time it is "constant" so return it
-    if (times.size() == 1)
+    // there is only one time (likely "constant") so return it
+    if (timeDirs.size() == 1)
     {
-        return times[0];
+        return timeDirs[0];
     }
 
-    if (t < times[1].value())
+    if (t < timeDirs[1].value())
     {
-        return times[1];
+        return timeDirs[1];
     }
-    else if (t > times[times.size() - 1].value())
+    else if (t > timeDirs[timeDirs.size()-1].value())
     {
-        return times[times.size() - 1];
+        return timeDirs[timeDirs.size()-1];
     }
 
     label nearestIndex = -1;
     scalar deltaT = GREAT;
 
-    for (label i=1; i < times.size(); i++)
+    for (label timeI=1; timeI < timeDirs.size(); ++timeI)
     {
-        scalar diff = mag(times[i].value() - t);
+        scalar diff = mag(timeDirs[timeI].value() - t);
         if (diff < deltaT)
         {
             deltaT = diff;
-            nearestIndex = i;
+            nearestIndex = timeI;
         }
     }
 
-    return times[nearestIndex];
+    return timeDirs[nearestIndex];
 }
 
 
@@ -440,29 +440,29 @@ Foam::instant Foam::Time::findClosestTime(const scalar t) const
 //
 // Foam::instant Foam::Time::findClosestTime(const scalar t) const
 // {
-//     instantList times = Time::findTimes(path());
-//     label timeIndex = min(findClosestTimeIndex(times, t), 0);
-//     return times[timeIndex];
+//     instantList timeDirs = findTimes(path());
+//     label timeIndex = min(findClosestTimeIndex(timeDirs, t), 0);
+//     return timeDirs[timeIndex];
 // }
 
 Foam::label Foam::Time::findClosestTimeIndex
 (
-    const instantList& times,
+    const instantList& timeDirs,
     const scalar t
 )
 {
     label nearestIndex = -1;
     scalar deltaT = GREAT;
 
-    forAll (times, i)
+    forAll(timeDirs, timeI)
     {
-        if (times[i].name() == "constant") continue;
+        if (timeDirs[timeI].name() == "constant") continue;
 
-        scalar diff = fabs(times[i].value() - t);
+        scalar diff = mag(timeDirs[timeI].value() - t);
         if (diff < deltaT)
         {
             deltaT = diff;
-            nearestIndex = i;
+            nearestIndex = timeI;
         }
     }
 
diff --git a/src/OpenFOAM/db/Time/timeSelector.C b/src/OpenFOAM/db/Time/timeSelector.C
index 8cd7940ccff7884a15a245fabed7d3a0c0f14e15..caf8c4f3a0fc608c92bc92b16ea956eb4b9c96ec 100644
--- a/src/OpenFOAM/db/Time/timeSelector.C
+++ b/src/OpenFOAM/db/Time/timeSelector.C
@@ -170,7 +170,7 @@ Foam::List<Foam::instant> Foam::timeSelector::select
         // determine latestTime selection (if any)
         // this must appear before the -time option processing
         label latestIdx = -1;
-        if (args.options().found("latestTime"))
+        if (args.optionFound("latestTime"))
         {
             selectTimes = false;
             latestIdx = timeDirs.size() - 1;
@@ -182,12 +182,12 @@ Foam::List<Foam::instant> Foam::timeSelector::select
             }
         }
 
-        if (args.options().found("time"))
+        if (args.optionFound("time"))
         {
             // can match 0/, but can never match constant/
             selectTimes = timeSelector
             (
-                IStringStream(args.options()["time"])()
+                args.optionLookup("time")()
             ).selected(timeDirs);
         }
 
@@ -201,13 +201,13 @@ Foam::List<Foam::instant> Foam::timeSelector::select
         if (constantIdx >= 0)
         {
             // only add constant/ if specifically requested
-            selectTimes[constantIdx] = args.options().found("constant");
+            selectTimes[constantIdx] = args.optionFound("constant");
         }
 
         // special treatment for 0/
         if (zeroIdx >= 0)
         {
-            if (args.options().found("noZero"))
+            if (args.optionFound("noZero"))
             {
                 // exclude 0/ if specifically requested
                 selectTimes[zeroIdx] = false;
@@ -215,7 +215,7 @@ Foam::List<Foam::instant> Foam::timeSelector::select
             else if (argList::validOptions.found("zeroTime"))
             {
                 // with -zeroTime enabled, drop 0/ unless specifically requested
-                selectTimes[zeroIdx] = args.options().found("zeroTime");
+                selectTimes[zeroIdx] = args.optionFound("zeroTime");
             }
         }
 
diff --git a/src/OpenFOAM/db/Time/timeSelector.H b/src/OpenFOAM/db/Time/timeSelector.H
index 1138f1b0e5013436dcdc9658d4dbe537b54c9611..ecdb92bb33297157ef58b7f5d073dda150fd9405 100644
--- a/src/OpenFOAM/db/Time/timeSelector.H
+++ b/src/OpenFOAM/db/Time/timeSelector.H
@@ -85,7 +85,7 @@ class argList;
 class Time;
 
 /*---------------------------------------------------------------------------*\
-                       Class timeSelector Declaration
+                        Class timeSelector Declaration
 \*---------------------------------------------------------------------------*/
 
 class timeSelector
@@ -136,7 +136,7 @@ public:
         );
 
         //- Return the set of times selected based on the argList options
-        static List<Foam::instant> select
+        static List<instant> select
         (
             const List<instant>&,
             const argList& args
@@ -144,7 +144,7 @@ public:
 
         //- Return the set of times selected based on the argList options
         //  also set the runTime to the first instance
-        static List<Foam::instant> select0
+        static List<instant> select0
         (
             Time& runTime,
             const argList& args
diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H
index c5fcf5d53c7ab2aed02df2565430d8eb153d2a9b..9fdb0bb6d2224ceebdc76b53a66239849c5dd4e4 100644
--- a/src/OpenFOAM/global/argList/argList.H
+++ b/src/OpenFOAM/global/argList/argList.H
@@ -56,10 +56,10 @@ Description
     global case (same for serial and parallel jobs).
 
 Note
-    - Adjustment of the valid (mandatory) arguments by directly manipulating
-      the static member argList::validArgs.
-    - Adjustment of the valid options by directly manipulating
-      the static member argList::validOptions.
+    - Adjustment of the valid (mandatory) arguments
+      by directly manipulating the static member argList::validArgs.
+    - Adjustment of the valid options
+      by directly manipulating the static member argList::validOptions.
 
 SourceFiles
     argList.C
@@ -76,6 +76,7 @@ SourceFiles
 #include "word.H"
 #include "fileName.H"
 #include "parRun.H"
+#include "IStringStream.H"
 
 #include "sigFpe.H"
 #include "sigInt.H"
@@ -165,6 +166,36 @@ public:
 
         // Access
 
+            //- Name of executable
+            const word& executable() const
+            {
+                return executable_;
+            }
+
+            //- Return root path
+            const fileName& rootPath() const
+            {
+                return rootPath_;
+            }
+
+            //- Return case name
+            const fileName& globalCaseName() const
+            {
+                return globalCase_;
+            }
+
+            //- Return case name (parallel run) or global case (serial run)
+            const fileName& caseName() const
+            {
+                return case_;
+            }
+
+            //- Return the path
+            fileName path() const
+            {
+                return rootPath()/caseName();
+            }
+
             //- Return arguments
             const stringList& args() const
             {
@@ -181,34 +212,54 @@ public:
                 return options_;
             }
 
-            //- Name of executable
-            const word& executable() const
+            //- Return the argument string associated with the named option
+            const string& option(const word& opt) const
             {
-                return executable_;
+                return options_.operator[](opt);
             }
 
-            //- Return root path
-            const fileName& rootPath() const
+            //- Return true if the named option is found
+            bool optionFound(const word& opt) const
             {
-                return rootPath_;
+                return options_.found(opt);
             }
 
-            //- Return case name
-            const fileName& globalCaseName() const
+            //- Return an IStringStream to the named option
+            IStringStream optionLookup(const word& opt) const
             {
-                return globalCase_;
+                return IStringStream(option(opt));
             }
 
-            //- Return case name (parallel run) or global case (serial run)
-            const fileName& caseName() const
+            //- Read a value from the named option
+            template<class T>
+            T optionRead(const word& opt) const
             {
-                return case_;
+                T val;
+                optionLookup(opt)() >> val;
+                return val;
             }
 
-            //- Return the path
-            fileName path() const
+            //- Read a value from the named option if present.
+            //  Return true if the named option was found.
+            template<class T>
+            bool optionReadIfPresent(const word& opt, T& val) const
             {
-                return rootPath()/caseName();
+                if (optionFound(opt))
+                {
+                    optionLookup(opt)() >> val;
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
+            }
+
+            //- Read a List of values from the named option
+            template<class T>
+            List<T> optionReadList(const word& opt) const
+            {
+                return readList<T>(optionLookup(opt)());
             }
 
 
diff --git a/src/OpenFOAM/include/CintDefs.H b/src/OpenFOAM/include/CintDefs.H
index 7dcb75b6d47fab143d80ce84f04e27547288aa84..90e1f62a2f1a2cd098a4b8ecac448273cbae4635 100644
--- a/src/OpenFOAM/include/CintDefs.H
+++ b/src/OpenFOAM/include/CintDefs.H
@@ -1,6 +1,6 @@
 #ifdef __CINT__
-#define tmp Foam::tmp
-#define UList Foam::UList
-#define List Foam::List
-#define InfoProxy Foam::InfoProxy
+# define tmp Foam::tmp
+# define UList Foam::UList
+# define List Foam::List
+# define InfoProxy Foam::InfoProxy
 #endif
diff --git a/src/OpenFOAM/include/CintUndefs.H b/src/OpenFOAM/include/CintUndefs.H
index 20a47aea2aef9cf4967c63cc1e0485fd8db01130..6b0b69e99ceba4cca1744c51d733c6b685329344 100644
--- a/src/OpenFOAM/include/CintUndefs.H
+++ b/src/OpenFOAM/include/CintUndefs.H
@@ -1,6 +1,6 @@
 #ifdef __CINT__
-#undef tmp
-#undef UList
-#undef List
-#undef InfoProxy
+# undef tmp
+# undef UList
+# undef List
+# undef InfoProxy
 #endif
diff --git a/src/OpenFOAM/include/OSspecific.H b/src/OpenFOAM/include/OSspecific.H
index e4227879a6a55f17fc35c8464885cade7c554f69..d04243c23dbe9b38fa16d3395da0a5010ce7a1fb 100644
--- a/src/OpenFOAM/include/OSspecific.H
+++ b/src/OpenFOAM/include/OSspecific.H
@@ -26,11 +26,11 @@ InNamespace
     Foam
 
 Description
-    Functions used by OpenFOAM that are specific to the UNIX operating system
-    and need to be replaced or emulated on other systems.
+    Functions used by OpenFOAM that are specific to POSIX compliant
+    operating systems and need to be replaced or emulated on other systems.
 
 SourceFiles
-    Unix.C
+    POSIX.C
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/src/OpenFOAM/include/addConstantOption.H b/src/OpenFOAM/include/addConstantOption.H
deleted file mode 100644
index 22ef88d33b07526849dc9a3f1a01509675db5501..0000000000000000000000000000000000000000
--- a/src/OpenFOAM/include/addConstantOption.H
+++ /dev/null
@@ -1 +0,0 @@
-    argList::validOptions.insert("constant", "");
diff --git a/src/OpenFOAM/include/addLatestTimeOption.H b/src/OpenFOAM/include/addLatestTimeOption.H
deleted file mode 100644
index d241032e9a1c6b1ce9e5b77ca54d3f1eca634ae9..0000000000000000000000000000000000000000
--- a/src/OpenFOAM/include/addLatestTimeOption.H
+++ /dev/null
@@ -1 +0,0 @@
-    argList::validOptions.insert("latestTime", "");
diff --git a/src/OpenFOAM/include/addNoZeroOption.H b/src/OpenFOAM/include/addNoZeroOption.H
deleted file mode 100644
index deb25ee153254ca6e6478417e40bd5fc1000c7a3..0000000000000000000000000000000000000000
--- a/src/OpenFOAM/include/addNoZeroOption.H
+++ /dev/null
@@ -1 +0,0 @@
-    argList::validOptions.insert("noZero", "");
diff --git a/src/OpenFOAM/include/addRegionOption.H b/src/OpenFOAM/include/addRegionOption.H
index 382836d3299051bca85c37a483628aa602a883de..4ece251a17240b9054d84f6b3da0d759222047e7 100644
--- a/src/OpenFOAM/include/addRegionOption.H
+++ b/src/OpenFOAM/include/addRegionOption.H
@@ -1 +1,5 @@
-    argList::validOptions.insert("region", "name");
+//
+// addRegionOption.H
+// ~~~~~~~~~~~~~~~~~
+
+    Foam::argList::validOptions.insert("region", "name");
diff --git a/src/OpenFOAM/include/addTimeOption.H b/src/OpenFOAM/include/addTimeOption.H
deleted file mode 100644
index 1151c51dfde6b8e1a0e4e36f23117b21b8c3ba0f..0000000000000000000000000000000000000000
--- a/src/OpenFOAM/include/addTimeOption.H
+++ /dev/null
@@ -1 +0,0 @@
-    argList::validOptions.insert("time", "time");
diff --git a/src/OpenFOAM/include/addTimeOptions.H b/src/OpenFOAM/include/addTimeOptions.H
index 016d9c3ea56e9a62e9a63df16fa0bed71d2a2b03..ec57beec07a6b153ed55ccf52b3600ea888c8ca4 100644
--- a/src/OpenFOAM/include/addTimeOptions.H
+++ b/src/OpenFOAM/include/addTimeOptions.H
@@ -1,4 +1,8 @@
-#include "addConstantOption.H"
-#include "addTimeOption.H"
-#include "addLatestTimeOption.H"
-#include "addNoZeroOption.H"
+//
+// addTimeOptions.H
+// ~~~~~~~~~~~~~~~~
+
+    Foam::argList::validOptions.insert("constant", "");
+    Foam::argList::validOptions.insert("latestTime", "");
+    Foam::argList::validOptions.insert("noZero", "");
+    Foam::argList::validOptions.insert("time", "time");
diff --git a/src/OpenFOAM/include/addTimeOptionsNoConstant.H b/src/OpenFOAM/include/addTimeOptionsNoConstant.H
deleted file mode 100644
index 91056f6a3a49f7735ffc137a0404095cc172c549..0000000000000000000000000000000000000000
--- a/src/OpenFOAM/include/addTimeOptionsNoConstant.H
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "addTimeOption.H"
-#include "addLatestTimeOption.H"
diff --git a/src/OpenFOAM/include/checkConstantOption.H b/src/OpenFOAM/include/checkConstantOption.H
index 4b5dbc4356bf1b5cdf0f9bfd4965db5bb023e816..9f39ac65413c0f6bbb1b510993f3e122fea3955f 100644
--- a/src/OpenFOAM/include/checkConstantOption.H
+++ b/src/OpenFOAM/include/checkConstantOption.H
@@ -1,8 +1,14 @@
+//
+// checkConstantOption.H
+// ~~~~~~~~~~~~~~~~~~~~~
+// unless -constant is present, skip startTime if it is "constant"
+
     if
     (
-        !args.options().found("constant")
-     && Times.size() > 1
+        !args.optionFound("constant")
+     && (startTime < Times.size()-1)
+     && (Times[startTime].name() == "constant")
     )
-    {    
-        startTime = 1;
+    {
+        startTime++;
     }
diff --git a/src/OpenFOAM/include/checkLatestTimeOption.H b/src/OpenFOAM/include/checkLatestTimeOption.H
deleted file mode 100644
index 9256865d2fa40e932f4aa062a53a9621a1672a62..0000000000000000000000000000000000000000
--- a/src/OpenFOAM/include/checkLatestTimeOption.H
+++ /dev/null
@@ -1,4 +0,0 @@
-    if (args.options().found("latestTime"))
-    {
-        startTime = Times.size() - 1;
-    }
diff --git a/src/OpenFOAM/include/checkTimeOption.H b/src/OpenFOAM/include/checkTimeOption.H
index 70759dd81ba12b91617ed714a2ef9be8040b236a..64ef62440f0b18dda6d70dd9395ef6d0f054031a 100644
--- a/src/OpenFOAM/include/checkTimeOption.H
+++ b/src/OpenFOAM/include/checkTimeOption.H
@@ -1,7 +1,17 @@
-    if (args.options().found("time"))
+//
+// checkTimeOption.H
+// ~~~~~~~~~~~~~~~~~
+// check -time and -latestTime options
+
+    if (args.optionFound("time"))
     {
-        scalar timeValue(readScalar(IStringStream(args.options()["time"])()));
+        Foam::scalar timeValue = args.optionRead<scalar>("time");
 
-        startTime = Time::findClosestTimeIndex(Times, timeValue);
+        startTime = Foam::Time::findClosestTimeIndex(Times, timeValue);
         endTime = startTime + 1;
     }
+
+    if (args.optionFound("latestTime"))
+    {
+        startTime = Times.size() - 1;
+    }
diff --git a/src/OpenFOAM/include/checkTimeOptions.H b/src/OpenFOAM/include/checkTimeOptions.H
index 121b17797e5db58a0e181481c11c7c0a2a41b7d3..7b2b15b32955145cb08c801e89e1e15bc57c26a5 100644
--- a/src/OpenFOAM/include/checkTimeOptions.H
+++ b/src/OpenFOAM/include/checkTimeOptions.H
@@ -1,6 +1,12 @@
-    label startTime = 0;
-    label endTime = Times.size();
+//
+// checkTimeOptions.H
+// ~~~~~~~~~~~~~~~~~~
 
+    Foam::label startTime = 0;
+    Foam::label endTime = Times.size();
+
+// unless -constant is present, skip startTime if it is "constant"
 #   include "checkConstantOption.H"
+    
+// check -time and -latestTime options
 #   include "checkTimeOption.H"
-#   include "checkLatestTimeOption.H"
diff --git a/src/OpenFOAM/include/checkTimeOptionsNoConstant.H b/src/OpenFOAM/include/checkTimeOptionsNoConstant.H
index 4d5bfced69f7eebd1750b8155449bd4e6d94b6e6..407903ddc17ba8e5f0d2021f8bfe6dbb8b8f2f68 100644
--- a/src/OpenFOAM/include/checkTimeOptionsNoConstant.H
+++ b/src/OpenFOAM/include/checkTimeOptionsNoConstant.H
@@ -1,5 +1,9 @@
-    label startTime = 0;
-    label endTime = Times.size();
+//
+// checkTimeOptionsNoConstant.H
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+    Foam::label startTime = 0;
+    Foam::label endTime = Times.size();
+
+// check -time and -latestTime options
 #   include "checkTimeOption.H"
-#   include "checkLatestTimeOption.H"
diff --git a/src/OpenFOAM/include/createMesh.H b/src/OpenFOAM/include/createMesh.H
index a85c239f41f0abd121da986440ee2df5525b7722..630494649d5642631313e5226115de446a515e1d 100644
--- a/src/OpenFOAM/include/createMesh.H
+++ b/src/OpenFOAM/include/createMesh.H
@@ -1,4 +1,9 @@
-    Foam::Info<< "Create mesh for time = "
+//
+// createMesh.H
+// ~~~~~~~~~~~~
+
+    Foam::Info
+        << "Create mesh for time = "
         << runTime.timeName() << Foam::nl << Foam::endl;
 
     Foam::fvMesh mesh
diff --git a/src/OpenFOAM/include/createMeshNoClear.H b/src/OpenFOAM/include/createMeshNoClear.H
index d0e61ab7f8b606f66e85069648cbecd205f980aa..8526a37be6ec2c42d0d3d6581e265676ec229ec1 100644
--- a/src/OpenFOAM/include/createMeshNoClear.H
+++ b/src/OpenFOAM/include/createMeshNoClear.H
@@ -1,13 +1,19 @@
-    Info<< "Create mesh, no clear-out for time = "
-        << runTime.timeName() << nl << endl;
+//
+// createMeshNoClear.H
+// ~~~~~~~~~~~~~~~~~~~
+// currently identical to createMesh.H
 
-    fvMesh mesh
+    Foam::Info
+        << "Create mesh, no clear-out for time = "
+        << runTime.timeName() << Foam::nl << Foam::endl;
+
+    Foam::fvMesh mesh
     (
-        IOobject
+        Foam::IOobject
         (
-            fvMesh::defaultRegion,
+            Foam::fvMesh::defaultRegion,
             runTime.timeName(),
             runTime,
-            IOobject::MUST_READ
+            Foam::IOobject::MUST_READ
         )
     );
diff --git a/src/OpenFOAM/include/createNamedMesh.H b/src/OpenFOAM/include/createNamedMesh.H
index 2caebe8583985b5d85543c15bfdb730dfb972b43..f61ec2bd6e8836d39d895b4a0604a69e26e2c4cb 100644
--- a/src/OpenFOAM/include/createNamedMesh.H
+++ b/src/OpenFOAM/include/createNamedMesh.H
@@ -1,27 +1,30 @@
-    word regionName;
+//
+// createNamedMesh.H
+// ~~~~~~~~~~~~~~~~~
 
-    if (args.options().found("region"))
-    {
-        regionName = args.options()["region"];
+    Foam::word regionName;
 
-        Info<< "Create mesh " << regionName << " for time = "
-            << runTime.timeName() << nl << endl;
+    if (args.optionReadIfPresent("region", regionName))
+    {
+        Foam::Info
+            << "Create mesh " << regionName << " for time = "
+            << runTime.timeName() << Foam::nl << Foam::endl;
     }
     else
     {
-        regionName = fvMesh::defaultRegion;
-
-        Info<< "Create mesh for time = "
-            << runTime.timeName() << nl << endl;
+        regionName = Foam::fvMesh::defaultRegion;
+        Foam::Info
+            << "Create mesh for time = "
+            << runTime.timeName() << Foam::nl << Foam::endl;
     }
 
-    fvMesh mesh
+    Foam::fvMesh mesh
     (
-        IOobject
+        Foam::IOobject
         (
             regionName,
             runTime.timeName(),
             runTime,
-            IOobject::MUST_READ
+            Foam::IOobject::MUST_READ
         )
     );
diff --git a/src/OpenFOAM/include/createNamedPolyMesh.H b/src/OpenFOAM/include/createNamedPolyMesh.H
index 4bb8d1d34a53ed5133b580e2ee77c33e50bad5c6..bee8601c743ee3547f154b9c800c9cb2f900e0e0 100644
--- a/src/OpenFOAM/include/createNamedPolyMesh.H
+++ b/src/OpenFOAM/include/createNamedPolyMesh.H
@@ -1,27 +1,30 @@
-    word regionName;
+//
+// createNamedPolyMesh.H
+// ~~~~~~~~~~~~~~~~~~~~~
 
-    if (args.options().found("region"))
-    {
-        regionName = args.options()["region"];
+    Foam::word regionName;
 
-        Info<< "Create polyMesh " << regionName << " for time = "
-            << runTime.timeName() << nl << endl;
+    if (args.optionReadIfPresent("region", regionName))
+    {
+        Foam::Info
+            << "Create polyMesh " << regionName << " for time = "
+            << runTime.timeName() << Foam::nl << Foam::endl;
     }
     else
     {
-        regionName = polyMesh::defaultRegion;
-
-        Info<< "Create polyMesh for time = "
-            << runTime.timeName() << nl << endl;
+        regionName = Foam::polyMesh::defaultRegion;
+        Foam::Info
+            << "Create polyMesh for time = "
+            << runTime.timeName() << Foam::nl << Foam::endl;
     }
 
-    polyMesh mesh
+    Foam::polyMesh mesh
     (
-        IOobject
+        Foam::IOobject
         (
             regionName,
             runTime.timeName(),
             runTime,
-            IOobject::MUST_READ
+            Foam::IOobject::MUST_READ
         )
     );
diff --git a/src/OpenFOAM/include/createPolyMesh.H b/src/OpenFOAM/include/createPolyMesh.H
index 3249a6c02aade2f70a342a25157f3fca2c8fdb1e..02e25d1c519ab1a92fb56aa7d1e71baaf71b36e9 100644
--- a/src/OpenFOAM/include/createPolyMesh.H
+++ b/src/OpenFOAM/include/createPolyMesh.H
@@ -1,13 +1,18 @@
-    Info<< "Create polyMesh for time = "
-        << runTime.timeName() << nl << endl;
+//
+// createPolyMesh.H
+// ~~~~~~~~~~~~~~~~
 
-    polyMesh mesh
+    Foam::Info
+        << "Create polyMesh for time = "
+        << runTime.timeName() << Foam::nl << Foam::endl;
+
+    Foam::polyMesh mesh
     (
-        IOobject
+        Foam::IOobject
         (
-            polyMesh::defaultRegion,
+            Foam::polyMesh::defaultRegion,
             runTime.timeName(),
             runTime,
-            IOobject::MUST_READ
+            Foam::IOobject::MUST_READ
         )
     );
diff --git a/src/OpenFOAM/include/createTime.H b/src/OpenFOAM/include/createTime.H
index 7c600100fe1b57e0079fb4ae61e1528267dd0c2b..057814a8708a767ecdd07470abaef6779136dffe 100644
--- a/src/OpenFOAM/include/createTime.H
+++ b/src/OpenFOAM/include/createTime.H
@@ -1,3 +1,7 @@
+//
+// createTime.H
+// ~~~~~~~~~~~~
+
     Foam::Info<< "Create time\n" << Foam::endl;
 
     Foam::Time runTime
diff --git a/src/OpenFOAM/include/setRootCase.H b/src/OpenFOAM/include/setRootCase.H
index 09d961ea8a2312c076a9dc0e09c37032ddaf5fc8..587374d067c059aefd4dd78ce680e2eb20bbfd8f 100644
--- a/src/OpenFOAM/include/setRootCase.H
+++ b/src/OpenFOAM/include/setRootCase.H
@@ -1,6 +1,9 @@
-Foam::argList args(argc, argv);
+//
+// setRootCase.H
+// ~~~~~~~~~~~~~
 
-if (!args.checkRootCase())
-{
-    Foam::FatalError.exit();
-}
+    Foam::argList args(argc, argv);
+    if (!args.checkRootCase())
+    {
+        Foam::FatalError.exit();
+    }
diff --git a/src/meshTools/indexedOctree/treeDataEdge.C b/src/meshTools/indexedOctree/treeDataEdge.C
index 12f347c16483afff5664c6295b9211123f6c69f2..3f7ae86ce8c27c25bbc2d590ed99b1abecfb1cf8 100644
--- a/src/meshTools/indexedOctree/treeDataEdge.C
+++ b/src/meshTools/indexedOctree/treeDataEdge.C
@@ -134,7 +134,7 @@ void Foam::treeDataEdge::findNearest
     {
         label index = indices[i];
 
-        const edge& e = edges_[index];
+        const edge& e = edges_[edgeLabels_[index]];
 
         pointHit nearHit = e.line(points_).nearestDist(sample);
 
@@ -170,7 +170,7 @@ void Foam::treeDataEdge::findNearest
     {
         label index = indices[i];
 
-        const edge& e = edges_[index];
+        const edge& e = edges_[edgeLabels_[index]];
 
         // Note: could do bb test ? Worthwhile?
 
diff --git a/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C b/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C
index b64f5f8adbbc4a68d2d5f5c114e1ba7662e93700..080f02765881f785be50c5cdbf01ac6bd9d92981 100644
--- a/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C
+++ b/src/postProcessing/foamCalcFunctions/basic/addSubtract/addSubtract.C
@@ -232,14 +232,14 @@ void Foam::calcTypes::addSubtract::preCalc
             << exit(FatalError);
     }
 
-    if (args.options().found("field"))
+    if (args.optionFound("field"))
     {
-        addSubtractFieldName_ = args.options()["field"];
+        addSubtractFieldName_ = args.option("field");
         calcType_ = FIELD;
     }
-    else if (args.options().found("value"))
+    else if (args.optionFound("value"))
     {
-        addSubtractValueStr_ = args.options()["value"];
+        addSubtractValueStr_ = args.option("value");
         calcType_ = VALUE;
     }
     else
@@ -249,9 +249,9 @@ void Foam::calcTypes::addSubtract::preCalc
             << nl << exit(FatalError);
     }
 
-    if (args.options().found("resultName"))
+    if (args.optionFound("resultName"))
     {
-        resultName_ = args.options()["resultName"];
+        resultName_ = args.option("resultName");
     }
 }
 
diff --git a/wmake/Makefile b/wmake/Makefile
index 02c573a2659390c6f644afe3666442eb1692bd54..78b442e43df46b2ec4e517b835504945bf4d0ad4 100644
--- a/wmake/Makefile
+++ b/wmake/Makefile
@@ -63,7 +63,7 @@ CLASSES_DIR        = $(MAKE_DIR)/classes
 SYS_INC            =
 SYS_LIBS           =
 
-PROJECT_INC        = -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude -I$(LIB_SRC)/OSspecific/$(WM_OS)/lnInclude
+PROJECT_INC        = -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude -I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
 PROJECT_LIBS       = -l$(WM_PROJECT)
 ##
 ## unused: