diff --git a/bin/mpirunDebug b/bin/mpirunDebug
index 249dfbf60bef484e2b3abf84b2e334199575cb3d..61d2f212d850f8ff162aaf1b0ca764042de23cbb 100755
--- a/bin/mpirunDebug
+++ b/bin/mpirunDebug
@@ -29,6 +29,7 @@
 #     Driver script to run mpi jobs with the processes in a separate XTerm
 #     or to separate log files.
 #     Requires bash on all processors.
+#
 #------------------------------------------------------------------------------
 . $WM_PROJECT_DIR/bin/tools/RunFunctions    # Run functions
 
@@ -193,15 +194,17 @@ fi
 
 sourceFoam=false    # Fallback command
 
-# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
+# Same as foamEtcFile -mode=uo bashrc
+#
+# check ~/.$WM_PROJECT/$WM_PROJECT_API/
 # check ~/.$WM_PROJECT/
 # check <installedProject>/etc/
 if [ -n "$WM_PROJECT" ]
 then
     for i in \
-        $HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
-        $HOME/.$WM_PROJECT \
-        $WM_PROJECT_DIR/etc \
+        "$HOME/.$WM_PROJECT/$WM_PROJECT_API" \
+        "$HOME/.$WM_PROJECT" \
+        "$WM_PROJECT_DIR/etc" \
         ;
     do
         if [ -f "$i/bashrc" ]
diff --git a/tutorials/Alltest b/tutorials/Alltest
index f4d6b9dfa59ab714b2dfbd0f60657a367b573c71..78fb64e6ecec37f0ca0d7a29ae8f2a8a8901a213 100755
--- a/tutorials/Alltest
+++ b/tutorials/Alltest
@@ -16,6 +16,9 @@
 # Description
 #     Quickly test the tutorials and write out the scheme/solver information
 #
+# Environment
+#     The entire OpenFOAM environment (WM_PROJECT_DIR, etc)
+#
 #------------------------------------------------------------------------------
 cd ${0%/*} || exit 1    # Run from this directory
 
@@ -128,24 +131,18 @@ EOF
 
 
 #
-# Location of the main controlDict
+# Location of the user or project controlDict
 #
-unset MAIN_CONTROL_DICT
-
-for i in \
-    $HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
-    $HOME/.$WM_PROJECT \
-    $WM_PROJECT_DIR/etc \
-    ;
-do
-    if [ -f "$i/controlDict" ]
+if MAIN_CONTROL_DICT="$($WM_PROJECT_DIR/bin/foamEtcFile -mode=uo controlDict)"
+then
+    if [ -e "${MAIN_CONTROL_DICT}.orig" ]
     then
-        MAIN_CONTROL_DICT="$i/controlDict"
-        break
+        die "File ${MAIN_CONTROL_DICT}.orig already exists" \
+            "Did Alltest fail in some way and then run again?"
     fi
-done
-
-[ -f "$MAIN_CONTROL_DICT" ] || usage "Main controlDict not found"
+else
+    die "No main (user or project) controlDict found"
+fi
 
 
 TUTORIALS_DIR=$ROOT
@@ -182,13 +179,6 @@ then
     rm -rf $buildDir
 fi
 
-if [ -e ${MAIN_CONTROL_DICT}.orig ]
-then
-    die "File ${MAIN_CONTROL_DICT}.orig already exists" \
-        "Did Alltest fail in some way and then run again?"
-fi
-
-
 unset gitbase
 
 if [ -n "$useGit" ]
diff --git a/wmake/wmakeScheduler b/wmake/wmakeScheduler
index ff07cb488917b97129542adeea2f6232619e1f41..08b05d5d5269a9069210b3a2c65e15f0ef0cf2a2 100755
--- a/wmake/wmakeScheduler
+++ b/wmake/wmakeScheduler
@@ -43,8 +43,10 @@
 #
 #     Sources the relevant cshrc/bashrc if not set.
 #
-#     WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set
-#     before calling this routine.
+# Environment
+#     - WM_PROJECT_DIR
+#     - WM_PROJECT
+#     - WM_PROJECT_API
 #
 #-------------------------------------------------------------------------------
 Script=${0##*/}
@@ -52,7 +54,7 @@ Script=${0##*/}
 # csh sets HOST, bash sets HOSTNAME
 : ${HOST:=$HOSTNAME}
 
-lockDir=$HOME/.$WM_PROJECT/.wmake
+lockDir="$HOME/.$WM_PROJECT/.wmake"
 
 # Fallback - 1 core on current host
 : ${WM_HOSTS:=$HOST:1}
@@ -86,15 +88,17 @@ case $SHELL in
     ;;
 esac
 
-# Check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
+# Same as foamEtcFile -mode=uo bashrc
+#
+# Check ~/.$WM_PROJECT/$WM_PROJECT_API/
 # Check ~/.$WM_PROJECT/
-# Check <installedProject>/etc/
+# Check projectDir/etc/
 if [ -n "$WM_PROJECT" ]
 then
     for i in \
-        $HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
-        $HOME/.$WM_PROJECT \
-        $WM_PROJECT_DIR/etc \
+        "$HOME/.$WM_PROJECT/$WM_PROJECT_API" \
+        "$HOME/.$WM_PROJECT" \
+        "$WM_PROJECT_DIR/etc" \
         ;
     do
         if [ -f "$i/$shellRc" ]
@@ -144,7 +148,6 @@ set -o pipefail
 #------------------------------------------------------------------------------
 colourPipe()
 {
-
     if tty -s <&1       #    [ "$1" ]
     then
     (
diff --git a/wmake/wmakeSchedulerUptime b/wmake/wmakeSchedulerUptime
index 569470fb56e727ed75708f00b7aa8bb04cc72a88..ec8d2e72484027f660641c93fc520ee101b8ef1f 100755
--- a/wmake/wmakeSchedulerUptime
+++ b/wmake/wmakeSchedulerUptime
@@ -43,8 +43,10 @@
 #
 #     Sources the relevant cshrc/bashrc if not set.
 #
-#     WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set
-#     before calling this routine.
+# Environment
+#     - WM_PROJECT_DIR
+#     - WM_PROJECT
+#     - WM_PROJECT_API
 #
 #-------------------------------------------------------------------------------
 Script=${0##*/}
@@ -52,7 +54,8 @@ Script=${0##*/}
 # csh sets HOST, bash sets HOSTNAME
 : ${HOST:=$HOSTNAME}
 
-lockDir=$HOME/.$WM_PROJECT/.wmake
+lockDir="$HOME/.$WM_PROJECT/.wmake"
+
 # Fallback - 1 core on current host
 : ${WM_HOSTS:=$HOST:1}
 
@@ -85,15 +88,17 @@ case $SHELL in
     ;;
 esac
 
-# Check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
+# Same as foamEtcFile -mode=uo bashrc
+#
+# Check ~/.$WM_PROJECT/$WM_PROJECT_API/
 # Check ~/.$WM_PROJECT/
-# Check <installedProject>/etc/
+# Check projectDir/etc/
 if [ -n "$WM_PROJECT" ]
 then
     for i in \
-        $HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
-        $HOME/.$WM_PROJECT \
-        $WM_PROJECT_DIR/etc \
+        "$HOME/.$WM_PROJECT/$WM_PROJECT_API" \
+        "$HOME/.$WM_PROJECT" \
+        "$WM_PROJECT_DIR/etc" \
         ;
     do
         if [ -f "$i/$shellRc" ]
@@ -138,9 +143,9 @@ done
 set -o pipefail
 
 
-#
+#------------------------------------------------------------------------------
 # Colour output by argument 1
-#
+#------------------------------------------------------------------------------
 colourPipe()
 {
     if [ -n "$1" ]
@@ -166,8 +171,7 @@ while [ "$#" -gt 0 ]
 do
     case "$1" in
     -np)
-        shift
-        nprocs=$1
+        nprocs="$2"
         shift
         ;;
     -*)
@@ -177,6 +181,7 @@ do
         break
         ;;
     esac
+    shift
 done