diff --git a/.gitattributes b/.gitattributes
index 21b05f8763ed54fadf61bd84b6be558875ca31ca..7716034027c82a4a91a4011072baab53a7861356 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2373,6 +2373,7 @@ Docker/lofar-base/bashrc.d/00-casacore -text
 Docker/lofar-base/bashrc.d/00-qpid -text
 Docker/lofar-base/bashrc.d/01-python-casacore -text
 Docker/lofar-base/bashrc.d/50-lofar -text
+Docker/lofar-base/casarc -text
 Docker/lofar-base/chuser.sh -text
 Docker/lofar-outputproc/Dockerfile.tmpl -text
 Docker/lofar-pipeline/Dockerfile.tmpl -text
diff --git a/CEP/Pipeline/framework/lofarpipe/support/remotecommand.py b/CEP/Pipeline/framework/lofarpipe/support/remotecommand.py
index 4df285da05bca4ddc0c2ca5db638c57c36e2bc93..cdef09c0b9106db4a9fe90b28d0880ace23a43a9 100644
--- a/CEP/Pipeline/framework/lofarpipe/support/remotecommand.py
+++ b/CEP/Pipeline/framework/lofarpipe/support/remotecommand.py
@@ -276,19 +276,24 @@ class ComputeJob(object):
                 self.results['returncode'] = 1
                 error.set()
                 return 1
-            cmdarray = run_remote_command(
-                config,
-                logger,
-                self.host,
-                self.command,
-                {
+
+            environment = {
                     "PATH": os.environ.get('PATH'),
                     "PYTHONPATH": os.environ.get('PYTHONPATH'),
                     "LD_LIBRARY_PATH": os.environ.get('LD_LIBRARY_PATH'),
                     "LOFARROOT" : os.environ.get('LOFARROOT'),
                     "LOFARENV" : os.environ.get('LOFARENV',''),
                     "QUEUE_PREFIX" : os.environ.get('QUEUE_PREFIX','')
-                },
+                }
+            if "cores" in self.resources:
+                environment["OMP_NUM_THREADS"] = str(self.resources["cores"])
+
+            cmdarray = run_remote_command(
+                config,
+                logger,
+                self.host,
+                self.command,
+                environment,
                 arguments = [id, jobhost, jobport],
                 resources = self.resources
             )
diff --git a/CEP/Pipeline/recipes/sip/nodes/dppp.py b/CEP/Pipeline/recipes/sip/nodes/dppp.py
index 6ef03658284f956278bf2bc0850586954c546c2e..7f803b6704d8e4259e5580354756fc91c59b3f6a 100644
--- a/CEP/Pipeline/recipes/sip/nodes/dppp.py
+++ b/CEP/Pipeline/recipes/sip/nodes/dppp.py
@@ -111,10 +111,6 @@ class dppp(LOFARnodeTCP):
                 )
                 shutil.copytree(infile, tmpfile)
 
-            # Limit number of threads used.
-            self.environment['OMP_NUM_THREADS'] = str(nthreads)
-            self.logger.debug("Using %s threads for NDPPP" % nthreads)
-
             # *****************************************************************
             # 3. Update the parset with locally calculate information
 
diff --git a/CEP/Pipeline/recipes/sip/nodes/imager_prepare.py b/CEP/Pipeline/recipes/sip/nodes/imager_prepare.py
index b590cc806804ce0c8ed8fcfcb2faf426f413ccad..7ff314cd11047ec42c46e1c2c77c1046b704adb8 100644
--- a/CEP/Pipeline/recipes/sip/nodes/imager_prepare.py
+++ b/CEP/Pipeline/recipes/sip/nodes/imager_prepare.py
@@ -220,9 +220,6 @@ class imager_prepare(LOFARnodeTCP):
         Muckable function running the dppp executable.
         Wraps dppp with catchLog4CPLus and catch_segfaults
         """
-        # TODO: cpu limited is static at this location
-        environment['OMP_NUM_THREADS'] = str(8)
-        self.logger.debug("Using %s threads for ndppp" % 8)
         with CatchLog4CPlus(working_dir, self.logger.name +
              "." + os.path.basename("imager_prepare_ndppp"),
                   os.path.basename(ndppp)) as logger:
diff --git a/CEP/Pipeline/recipes/sip/nodes/selfcal_awimager.py b/CEP/Pipeline/recipes/sip/nodes/selfcal_awimager.py
index db7267f7c3f03daac89d6ca2fe0ea83969834741..3343b52f0f3b98efc4e850949b6bd5078b1b806d 100644
--- a/CEP/Pipeline/recipes/sip/nodes/selfcal_awimager.py
+++ b/CEP/Pipeline/recipes/sip/nodes/selfcal_awimager.py
@@ -174,11 +174,6 @@ class selfcal_awimager(LOFARnodeTCP):
             # *****************************************************************
             # 5. Run the awimager with the parameterset
 
-            # TODO: FIXME: manually Limit number of threads used.
-            omp_num_threads = 8
-            self.environment['OMP_NUM_THREADS'] = str(omp_num_threads)
-            self.logger.debug("Using %s threads for swimager" % omp_num_threads)
-
             cmd = [executable, calculated_parset_path]
             self.logger.debug("Parset used for awimager run:")
             self.logger.debug(cmd)
diff --git a/Docker/lofar-base/Dockerfile.tmpl b/Docker/lofar-base/Dockerfile.tmpl
index a5679fe25f5246792c469484451e37f3ad1310d3..1c013ec15089cf35d8c1fb24ab6c73f650ab3f1f 100644
--- a/Docker/lofar-base/Dockerfile.tmpl
+++ b/Docker/lofar-base/Dockerfile.tmpl
@@ -64,7 +64,7 @@ RUN apt-get update && apt-get install -y wget git cmake g++ gfortran flex bison
     if [ "${CASACORE_VERSION}" != "latest" ]; then cd ${INSTALLDIR}/casacore/src && git checkout tags/v${CASACORE_VERSION}; fi && \
     cd ${INSTALLDIR}/casacore/data && wget --retry-connrefused ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar && \
     cd ${INSTALLDIR}/casacore/data && tar xf WSRT_Measures.ztar  && rm -f WSRT_Measures.ztar && \
-    cd ${INSTALLDIR}/casacore/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/casacore/ -DDATA_DIR=${INSTALLDIR}/casacore/data -DBUILD_PYTHON=True -DENABLE_TABLELOCKING=ON -DUSE_OPENMP=ON -DUSE_FFTW3=TRUE -DUSE_HDF5=ON -DCXX11=YES -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-fsigned-char -O2 -DNDEBUG -march=native" ../src/ && \
+    cd ${INSTALLDIR}/casacore/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/casacore/ -DDATA_DIR=${INSTALLDIR}/casacore/data -DBUILD_PYTHON=True -DENABLE_TABLELOCKING=OFF -DUSE_OPENMP=ON -DUSE_FFTW3=TRUE -DUSE_HDF5=ON -DCXX11=YES -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-fsigned-char -O2 -DNDEBUG -march=native" ../src/ && \
     cd ${INSTALLDIR}/casacore/build && make -j ${J} && \
     cd ${INSTALLDIR}/casacore/build && make install && \
     bash -c "strip ${INSTALLDIR}/casacore/{lib,bin}/* || true" && \
@@ -72,6 +72,10 @@ RUN apt-get update && apt-get install -y wget git cmake g++ gfortran flex bison
     apt-get purge -y wget git cmake g++ gfortran flex bison libopenblas-dev libfftw3-dev libhdf5-dev libboost-python-dev libcfitsio-dev wcslib-dev && \
     apt-get autoremove -y --purge
 
+# Install and enable custom casarc
+COPY ["casarc",    "${INSTALLDIR}/"]
+ENV  CASARCFILES=${INSTALLDIR}/casarc
+
 #
 # *******************
 #   Casarest
diff --git a/Docker/lofar-base/casarc b/Docker/lofar-base/casarc
new file mode 100644
index 0000000000000000000000000000000000000000..f988729b2f187568d191f366853e1030c589060f
--- /dev/null
+++ b/Docker/lofar-base/casarc
@@ -0,0 +1,2 @@
+# Write MeasurementSets using fewer files, and 4MB blocks
+tables.storage.type = multifile