diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/CMakeLists.txt b/CEP/DP3/AOFlagger/include/AOFlagger/CMakeLists.txt
index 1533589e5eb9e8a6f09c1c53355eef480e9ce96c..eb30e8c09adb8f858828e572399acb275bea3ea6 100644
--- a/CEP/DP3/AOFlagger/include/AOFlagger/CMakeLists.txt
+++ b/CEP/DP3/AOFlagger/include/AOFlagger/CMakeLists.txt
@@ -25,7 +25,6 @@ install(FILES
   gui/imagewidget.h
   gui/msoptionwindow.h
   gui/mswindow.h
-  gui/newstrategyactionframe.h
   gui/plotframe.h
   gui/progresswindow.h
   gui/rawoptionwindow.h
@@ -61,7 +60,6 @@ install(FILES
   gui/strategyframes/spatialcompositionframe.h
   gui/strategyframes/statisticalflaggingframe.h
   gui/strategyframes/svdframe.h
-  gui/strategyframes/thresholdframe.h
   gui/strategyframes/timeconvolutionframe.h
   gui/strategyframes/timeselectionframe.h
   gui/strategyframes/uvprojectframe.h
@@ -124,7 +122,6 @@ install(FILES
   strategy/actions/statisticalflagaction.h
   strategy/actions/strategyaction.h
   strategy/actions/svdaction.h
-  strategy/actions/thresholdaction.h
   strategy/actions/timeselectionaction.h
   strategy/actions/uvprojectaction.h
   strategy/actions/writedataaction.h
diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/imagetile.h b/CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/imagetile.h
index 95b2039ead2319b859a9f3f24755fb39da4c4caf..c7b7fdda1977a166cbc07e97c525359dc60c9863 100644
--- a/CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/imagetile.h
+++ b/CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/imagetile.h
@@ -22,10 +22,6 @@
 
 #include <string>
 
-#include <gsl/gsl_vector.h>
-#include <gsl/gsl_matrix.h>
-#include <gsl/gsl_multifit_nlin.h>
-
 /**
 	@author A.R. Offringa <offringa@astro.rug.nl>
 */
@@ -77,30 +73,30 @@ private:
 	void WindowSquare(unsigned scanIndex, unsigned frequencyIndex);
 
 	// This function calculates the sum of the squared errors when the parameters in 'x' are used. 
-	static int BaselineFunction(const gsl_vector * x, void *data, gsl_vector * f);
+	//static int BaselineFunction(const gsl_vector * x, void *data, gsl_vector * f);
 
 	// This function calculates the sum of the squared errors when the parameters in 'x' are used. 
-	static int BaselineFunctionMPF(const gsl_vector * x, void *data, gsl_vector * f);
+	//static int BaselineFunctionMPF(const gsl_vector * x, void *data, gsl_vector * f);
 
 	// This function calculates the Jacobian matrix of "BaselineFunction()".
-	static int BaselineDerivative(const gsl_vector * x, void *data, gsl_matrix * J);
+	//static int BaselineDerivative(const gsl_vector * x, void *data, gsl_matrix * J);
 
 	// This function calculates the Jacobian matrix of "BaselineFunction()".
-	static int BaselineDerivativeMPF(const gsl_vector * x, void *data, gsl_matrix * J);
+	//static int BaselineDerivativeMPF(const gsl_vector * x, void *data, gsl_matrix * J);
 
-	static int BaselineCombined(const gsl_vector * x, void *data, gsl_vector * f, gsl_matrix * J)
+	/*static int BaselineCombined(const gsl_vector * x, void *data, gsl_vector * f, gsl_matrix * J)
 	{
 		BaselineFunction(x, data, f);
 		BaselineDerivative(x, data, J);
 		return GSL_SUCCESS;
-	}
+		}*/
 
-	static int BaselineCombinedMPF(const gsl_vector * x, void *data, gsl_vector * f, gsl_matrix * J)
+	/8static int BaselineCombinedMPF(const gsl_vector * x, void *data, gsl_vector * f, gsl_matrix * J)
 	{
 		BaselineFunctionMPF(x, data, f);
 		BaselineDerivativeMPF(x, data, J);
 		return GSL_SUCCESS;
-	}
+	}*/
 
 	//void PrintState(unsigned iter, gsl_multifit_fdfsolver *solver);
 };
diff --git a/CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/interpolatenansalgorithm.h b/CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/interpolatenansalgorithm.h
index f61bd623fdd0c97c288133e9dde4a32a9ca7d96b..12e4dbcae0d22458f161b7a6bb60228b7232512e 100644
--- a/CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/interpolatenansalgorithm.h
+++ b/CEP/DP3/AOFlagger/include/AOFlagger/strategy/algorithms/interpolatenansalgorithm.h
@@ -21,10 +21,7 @@ class InterpolateNansAlgorithms
 					}
 				}
 			}
-			if(count > 0)
-			{
 				AOLogger::Debug << "Number of nans: " << count << '\n';
-			}
 		}
 };
 
diff --git a/CEP/DP3/AOFlagger/src/aosynchronisation.cpp b/CEP/DP3/AOFlagger/src/aosynchronisation.cpp
index 9bb2077d6e8fd66270b6ab0b4f30f3d5415c674e..9b87bdf0536564c20d87c90419b2293524b02139 100644
--- a/CEP/DP3/AOFlagger/src/aosynchronisation.cpp
+++ b/CEP/DP3/AOFlagger/src/aosynchronisation.cpp
@@ -74,6 +74,14 @@ void runMaster()
 				//  std::cout << "Resource " << i << " is released" << std::endl;
 				setReadLock(copy, i, readLock(memptr, i));
 			}
+			if(writeLock(copy, i) != writeLock(memptr, i))
+			  {
+				if(writeLock(memptr, i) != 0)
+				  std::cout << "Resource " << i << " is uniquely locked" << std::endl;
+				//else
+				//  std::cout << "Resource " << i << " is uniquely released" << std::endl;
+				setWriteLock(copy, i, writeLock(memptr, i));
+			  }
 		}
 	}
 	mutex.remove(MUTEX_NAME);
@@ -188,7 +196,10 @@ int main(int argc, char *argv[])
 		else if(operation == "release" && argc >= 3) runRelease(atoi(argv[2]));
 		else if(operation == "release-unique" && argc >= 3) runReleaseUnique(atoi(argv[2]));
 		else if(operation == "clean") runClean();
-		else printError(argv[0]);
+		else {
+		  cerr << "Unknown operation: " << operation << "\n";
+		  printError(argv[0]);
+		}
 	}
 }
 #else
diff --git a/CEP/DP3/AOFlagger/src/msio/timestepaccessor.cpp b/CEP/DP3/AOFlagger/src/msio/timestepaccessor.cpp
index 75eec06bf81abd3e158bbc8e4f9849ab08819245..bb105628e9d26b2756a9b5ec5b7c0de90f5bb423 100644
--- a/CEP/DP3/AOFlagger/src/msio/timestepaccessor.cpp
+++ b/CEP/DP3/AOFlagger/src/msio/timestepaccessor.cpp
@@ -71,7 +71,7 @@ void TimestepAccessor::Open()
 	else
 		_currentRow = _totalRowCount;
 	_endRow = _totalRowCount;
-	_bufferSize = 10000;
+	_bufferSize = 20000;
 	_readBuffer = new BufferItem[_bufferSize];
 	_readBufferPtr = 0;
 	_inReadBuffer = 0;
@@ -123,7 +123,10 @@ bool TimestepAccessor::ReadNext(TimestepAccessor::TimestepIndex &index, Timestep
 void TimestepAccessor::openSet(TimestepAccessor::SetInfo &set, bool update)
 {
 	std::ostringstream s;
-	s << "ssh node079 -C \"~/LOFAR-build/aosynchronisation lock \"" << set.index << " 2> /dev/null\n";
+	if(update)
+	  s << "ssh node079 -C \"~/LOFAR-build/bin/aosynchronisation lock-unique \"" << set.index << " 2> /dev/null\n";
+	else
+	  s << "ssh node079 -C \"~/LOFAR-build/bin/aosynchronisation lock-unique \"" << set.index << " 2> /dev/null\n";
 	std::string str = s.str();
 	system(str.c_str());
 	
@@ -163,6 +166,7 @@ void TimestepAccessor::closeSet(TimestepAccessor::SetInfo &set)
 	delete set.antenna1Column;
 	delete set.antenna2Column;
 	delete set.timeColumn;
+	bool update = set.updateDataColumn != 0;
 	if(set.dataColumn != 0)
 		delete set.dataColumn;
 	if(set.updateDataColumn != 0)
@@ -171,7 +175,10 @@ void TimestepAccessor::closeSet(TimestepAccessor::SetInfo &set)
 	delete set.table;
 
 	std::ostringstream s;
-	s << "ssh node079 -C \"~/LOFAR-build/aosynchronisation release \"" << set.index << " 2> /dev/null\n";
+	if(update)
+	  s << "ssh node079 -C \"~/LOFAR-build/bin/aosynchronisation release-unique \"" << set.index << " 2> /dev/null\n";
+	else
+	  s << "ssh node079 -C \"~/LOFAR-build/bin/aosynchronisation release-unique \"" << set.index << " 2> /dev/null\n";
 	std::string str = s.str();
 	system(str.c_str());
 }
@@ -213,7 +220,21 @@ bool TimestepAccessor::fillReadBuffer()
 			}
 			else {
 				if(data.timestep != ((*set.timeColumn)(row)))
-					throw TimestepAccessorException("Sets do not have same time steps");
+				  {
+				    std::stringstream s;
+				    bool onlyWarn;
+				    double thisTimestep = (*set.timeColumn)(row);
+				    if(fabs(data.timestep - (*set.timeColumn)(row)) < 1e-3)
+				      onlyWarn = true;
+				    else
+				      onlyWarn = false;
+				    s << "Sets do not have equal time steps; first set has " << data.timestep << " while set " << set.index << " has " << thisTimestep << " (row=" << row << ", difference=" << (data.timestep-thisTimestep) << ")";
+				    if(onlyWarn)
+				      std::cout << "WARNING: " << s.str() << "\nIgnoring difference because it is < 1e-3\n";
+				    else
+				      throw TimestepAccessorException(s.str());
+					
+				  }
 				if(data.antenna1 != (unsigned) ((*set.antenna1Column)(row)))
 					throw TimestepAccessorException("Sets do not have same antenna1 ordering");
 				if(data.antenna2 != (unsigned) ((*set.antenna2Column)(row)))
diff --git a/CEP/DP3/AOFlagger/src/strategy/algorithms/imagetile.cpp b/CEP/DP3/AOFlagger/src/strategy/algorithms/imagetile.cpp
index eb11d1b46dd1a8a4fadc008bf14dda0e71d64eae..2750d946849e619aca9a176c21916ecd0817af0a 100644
--- a/CEP/DP3/AOFlagger/src/strategy/algorithms/imagetile.cpp
+++ b/CEP/DP3/AOFlagger/src/strategy/algorithms/imagetile.cpp
@@ -27,9 +27,6 @@
 
 #include <AOFlagger/strategy/algorithms/thresholdmitigater.h>
 
-#include <gsl/gsl_blas.h>
-
-//#include <gmp.h>
 #include <iostream>
 #include <math.h>
 
@@ -95,197 +92,6 @@ void ImageTile::ConvolveWindows()
 	delete oldWindows;
 }
 
-int ImageTile::BaselineFunction(const gsl_vector * x, void *data, gsl_vector * f)
-{		
-	ImageTile *tile = (ImageTile *) data;
-	for(unsigned channel=0; channel<tile->_channelCount; ++channel) {
-		for(unsigned scan=0; scan<tile->_scanCount; ++scan) {
-			unsigned f_index = channel + scan*tile->_channelCount;
-			if(tile->_isWindowed[channel][scan]) {
-				gsl_vector_set(f, f_index, 0.0);
-			} else {
-				long double term = gsl_vector_get(x, 0) - tile->GetValueAt(channel, scan);
-				
-				for(int j=1;j <= tile->_freqOrder;++j)
-					term += gsl_vector_get(x, j) * pow((long double) channel, (long double) j);
-				for(int j=1;j <= tile->_timeOrder;++j)
-					term += gsl_vector_get(x, j + tile->_freqOrder) * pow((long double) scan, (long double) j);
-				gsl_vector_set(f, f_index, term * term);
-			}
-		}
-	}
-	return GSL_SUCCESS;
-}
-
-/*
-int ImageTile::BaselineFunctionMPF(const gsl_vector * x, void *data, gsl_vector * f)
-{		
-	ImageTile *tile = (ImageTile *) data;
-	mpf_t term, tmpA, tmpB;
-	mpf_init(term);
-	mpf_init(tmpA);
-	mpf_init(tmpB);
-	for(unsigned channel=0; channel<tile->_channelCount; ++channel) {
-		for(unsigned scan=0; scan<tile->_scanCount; ++scan) {
-			unsigned f_index = channel + scan*tile->_channelCount;
-			if(tile->_isWindowed[channel][scan]) {
-				gsl_vector_set(f, f_index, 0.0);
-			} else {
-				mpf_set_d(tmpA, gsl_vector_get(x,0));
-				mpf_set_d(tmpB, tile->GetValueAt(channel, scan));
-				mpf_sub(term, tmpA, tmpB);
-				
-				for(int j=1;j <= tile->_freqOrder;++j) {
-					// term += gsl_vector_get(x, j) * pow((long double) channel, (long double) j);
-					mpf_set_ui(tmpA, channel);
-					mpf_pow_ui(tmpA, tmpA, j);
-					mpf_set_d(tmpB, gsl_vector_get(x, j));
-					mpf_mul(tmpA, tmpA, tmpB);
-					mpf_add(term, term, tmpA);
-				}
-				for(int j=1;j <= tile->_timeOrder;++j) {
-					// term += gsl_vector_get(x, j + tile->_freqOrder) * pow((long double) scan, (long double) j);
-					mpf_set_ui(tmpA, scan);
-					mpf_pow_ui(tmpA, tmpA, j);
-					mpf_set_d(tmpB, gsl_vector_get(x, j + tile->_freqOrder));
-					mpf_mul(tmpA, tmpA, tmpB);
-					mpf_add(term, term, tmpA);
-				}
-				// term = term*term
-				mpf_mul(term, term, term);
-				gsl_vector_set(f, f_index, mpf_get_d(term));
-			}
-		}
-	}
-	mpf_clear(term);
-	mpf_clear(tmpA);
-	mpf_clear(tmpB);
-	return GSL_SUCCESS;
-}*/
-
-int ImageTile::BaselineDerivative(const gsl_vector * x, void *data, gsl_matrix * J)
-{
-	ImageTile *tile = (ImageTile *) data;
-	long double factor = 0.0;
-	for(unsigned channel=0; channel<tile->_channelCount; ++channel) {
-		for(unsigned scan=0; scan<tile->_scanCount; ++scan) {
-			unsigned f_index = channel + scan*tile->_channelCount;
-			if(tile->_isWindowed[channel][scan]) {
-				for(int h = 1; h <= tile->_freqOrder ; ++h) {
-					gsl_matrix_set(J, f_index, h, 0.0);
-				}
-			} else {
-				long double term = gsl_vector_get(x, 0) - tile->GetValueAt(channel, scan);
-				
-				for(int j=1;j <= tile->_freqOrder;++j)
-					term += gsl_vector_get(x, j) * pow((long double) channel, (long double) j);
-				for(int j=1;j <= tile->_timeOrder;++j)
-					term += gsl_vector_get(x, j + tile->_freqOrder) * pow((long double) scan, (long double) j);
-				factor = 2.0 * term;
-				
-				long double value = factor;
-				gsl_matrix_set(J, f_index, 0, value);
-
-				for(int h = 1; h <= tile->_freqOrder ; ++h) {
-					value = factor * pow((long double) channel, (long double) h);
-					gsl_matrix_set(J, f_index, h, value);
-				}
-				
-				for(int h = 1; h <= tile->_timeOrder ; ++h) {
-					value = factor * pow((long double) scan, (long double) h);
-					gsl_matrix_set(J, f_index, h + tile->_freqOrder, value);
-				}
-			}
-		}
-	}
-	return GSL_SUCCESS;
-}
-
-/*
-int ImageTile::BaselineDerivativeMPF(const gsl_vector * x, void *data, gsl_matrix * J)
-{
-	ImageTile *tile = (ImageTile *) data;
-	mpf_t factor, term, tmpA, tmpB;
-	mpf_init(factor);
-	mpf_init(term);
-	mpf_init(tmpA);
-	mpf_init(tmpB);
-	for(unsigned channel=0; channel<tile->_channelCount; ++channel) {
-		for(unsigned scan=0; scan<tile->_scanCount; ++scan) {
-			unsigned f_index = channel + scan*tile->_channelCount;
-			if(tile->_isWindowed[channel][scan]) {
-				for(int h = 1; h <= tile->_freqOrder ; ++h) {
-					gsl_matrix_set(J, f_index, h, 0.0);
-				}
-			} else {
-				// term = gsl_vector_get(x, 0) - tile->GetValueAt(channel, scan);
-				mpf_set_d(term, gsl_vector_get(x, 0));
-				mpf_set_d(tmpA, tile->GetValueAt(channel, scan));
-				mpf_sub(term, term, tmpA);
-				
-				for(int j=1;j <= tile->_freqOrder;++j) {
-					// term += gsl_vector_get(x, j) * pow((long double) channel, (long double) j);
-					mpf_set_ui(tmpA, channel);
-					mpf_pow_ui(tmpA, tmpA, j);
-					mpf_set_d(tmpB, gsl_vector_get(x, j));
-					mpf_mul(tmpA, tmpA, tmpB);
-					mpf_add(term, term, tmpA);
-				}
-
-				for(int j=1;j <= tile->_timeOrder;++j) {
-					// term += gsl_vector_get(x, j + tile->_freqOrder) * pow((long double) scan, (long double) j);
-					mpf_set_ui(tmpA, scan);
-					mpf_pow_ui(tmpA, tmpA, j);
-					mpf_set_d(tmpB, gsl_vector_get(x, j + tile->_freqOrder));
-					mpf_mul(tmpA, tmpA, tmpB);
-					mpf_add(term, term, tmpA);
-				}
-				// factor = 2.0 * term;
-				mpf_set(factor, term);
-				mpf_mul_ui(factor, factor, 2);
-				
-				gsl_matrix_set(J, f_index, 0, mpf_get_d(factor));
-
-				for(int h = 1; h <= tile->_freqOrder ; ++h) {
-					// value = factor * pow((long double) channel, (long double) h);
-					mpf_set_ui(tmpA, channel);
-					mpf_pow_ui(tmpA, tmpA, h);
-					mpf_mul(tmpA, factor, tmpA);
-
-					gsl_matrix_set(J, f_index, h, mpf_get_d(tmpA));
-				}
-				
-				for(int h = 1; h <= tile->_timeOrder ; ++h) {
-					// value = factor * pow((long double) scan, (long double) h);
-					mpf_set_ui(tmpA, scan);
-					mpf_pow_ui(tmpA, tmpA, h);
-					mpf_mul(tmpA, factor, tmpA);
-
-					gsl_matrix_set(J, f_index, h + tile->_freqOrder, mpf_get_d(tmpA));
-				}
-			}
-		}
-	}
-	mpf_clear(factor);
-	mpf_clear(term);
-	mpf_clear(tmpA);
-	mpf_clear(tmpB);
-	return GSL_SUCCESS;
-}*/
-
-/*void ImageTile::PrintState(unsigned iter, gsl_multifit_fdfsolver *solver)
-{
-	std::cout << "f[v,t] := " << gsl_vector_get(solver->x, 0);
-	for(int i=1;i<=_freqOrder;++i)
-		std::cout << " + " << gsl_vector_get(solver->x, i) << "*v^" << i;
-	
-	for(int i=1;i<=_timeOrder;++i)
-		std::cout << " + " << gsl_vector_get(solver->x, i+_freqOrder) << "*t^" << i;
-	
-	//std::cout << std::endl << "Iteration " << iter << ": |f(x)|=" << gsl_blas_dnrm2(solver->f) << ", mean = " << _mean << ", variance = " << _variance << ", " << WindowCount() << "/" << (_channelCount*_scanCount);
-	std::cout << std::endl;
-}*/
-
 unsigned ImageTile::WindowCount() const {
 	unsigned count = 0;
 	for(unsigned channel=0; channel<_channelCount; ++channel) {