diff --git a/MAC/APL/CEPCU/configure.in b/MAC/APL/CEPCU/configure.in
index dd04c10b369613f387e93860daf5fd71ce383ed4..f559b22c8962a94b6ffd93f122892270ff37bfc6 100644
--- a/MAC/APL/CEPCU/configure.in
+++ b/MAC/APL/CEPCU/configure.in
@@ -75,6 +75,7 @@ AC_OUTPUT(
 src/Makefile
 src/ApplController/Makefile
 src/CEPlogProcessor/Makefile
+src/BGPlogProcessor/Makefile
 src/OnlineControl/Makefile
 dnl src/OfflineControl/Makefile
 Makefile
diff --git a/MAC/APL/CEPCU/src/BGPlogProcessor/BGPlogProcessor.cc b/MAC/APL/CEPCU/src/BGPlogProcessor/BGPlogProcessor.cc
new file mode 100644
index 0000000000000000000000000000000000000000..95ee9fa602a77d2b10e3043a799adaa3f1942a1c
--- /dev/null
+++ b/MAC/APL/CEPCU/src/BGPlogProcessor/BGPlogProcessor.cc
@@ -0,0 +1,244 @@
+//#  BGPlogProcessor.cc: Captures cout datastreams of CEP programs
+//#
+//#  Copyright (C) 2009
+//#  ASTRON (Netherlands Foundation for Research in Astronomy)
+//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//#  This program 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.
+//#
+//#  This program 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 this program; if not, write to the Free Software
+//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//#  $Id$
+
+//# Always #include <lofar_config.h> first!
+#include <lofar_config.h>
+
+//# Includes
+#include <Common/LofarLogger.h>
+#include <Common/LofarLocators.h>
+#include <Common/ParameterSet.h>
+#include <Common/SystemUtil.h>
+#include "BGPlogProcessor.h"
+
+namespace LOFAR {
+  using namespace GCF::TM;
+  namespace APL {
+
+//
+// BGPlogProcessor(name)
+//
+BGPlogProcessor::BGPlogProcessor(const string&	progName) :
+	GCFTask		((State)&BGPlogProcessor::startListener, progName),
+	itsListener	(0)
+{
+	// prepare TCP port to accept connections on
+	itsListener = new GCFTCPPort (*this, "BGPlogger:v1_0", GCFPortInterface::MSPP, 0);
+	ASSERTSTR(itsListener, "Cannot allocate listener port");
+	itsListener->setPortNumber(globalParameterSet()->getInt("BGPlogProcessor.portNr"));
+
+	itsBufferSize = globalParameterSet()->getInt("BGPlogProcessor.bufferSize", 1024);
+}
+
+//
+// ~BGPlogProcessor()
+//
+BGPlogProcessor::~BGPlogProcessor()
+{
+	if (itsListener) { 
+		delete itsListener; 
+	}
+}
+
+//
+// startListener(event, port)
+//
+GCFEvent::TResult BGPlogProcessor::startListener(GCFEvent&	event, GCFPortInterface&	port)
+{
+	LOG_DEBUG_STR("startListener:" << eventName(event) << "@" << port.getName());
+
+	switch (event.signal) {
+	case F_INIT:
+		itsListener->autoOpen(0, 10, 2);	// report within 10 seconds.
+		break;
+
+	case F_CONNECTED:
+		LOG_DEBUG("Listener is started, going to operational mode");
+		TRAN (BGPlogProcessor::operational);
+		break;
+
+	case F_DISCONNECTED:
+		LOG_FATAL_STR("Cannot open the listener on port " << itsListener->getPortNumber() << ". Quiting!");
+		GCFScheduler::instance()->stop();
+		break;
+	}
+
+	return (GCFEvent::HANDLED);
+}
+
+//
+// operational(event, port)
+//
+GCFEvent::TResult BGPlogProcessor::operational(GCFEvent& event, GCFPortInterface& port)
+{
+	LOG_DEBUG_STR("operational:" << eventName(event) << "@" << port.getName());
+
+	switch (event.signal) {
+	case F_ACCEPT_REQ:
+		_handleConnectionRequest();
+		break;
+
+	case F_CONNECTED:
+		break;
+
+	case F_DISCONNECTED:
+		port.close();
+	case F_DATAIN:
+		_handleDataStream(&port);
+		break;
+	}
+
+	return (GCFEvent::HANDLED);
+}
+
+//
+// _handleConnectionRequest()
+//
+void BGPlogProcessor::_handleConnectionRequest()
+{
+	GCFTCPPort* 	pNewClient = new GCFTCPPort();
+	ASSERT(pNewClient);
+
+	pNewClient->init(*this, "newClient", GCFPortInterface::SPP, 0, true);
+	if (!itsListener->accept(*pNewClient)) {
+		LOG_WARN("Connection with new client went wrong");
+		return;
+	}
+
+	// give stream its own buffer.
+	streamBuffer_t		stream;
+	stream.socket	= pNewClient;
+	stream.buffer 	= (char*)malloc(itsBufferSize);
+	stream.inPtr  	= 0;
+	stream.outPtr 	= 0;
+	itsLogStreams[pNewClient] = stream;
+	LOG_INFO_STR("Added new client to my admin");
+}
+
+//
+// _handleDataStream(sid)
+//
+void BGPlogProcessor::_handleDataStream(GCFPortInterface*	port)
+{
+	// read in the new bytes
+	streamBuffer_t	stream		= itsLogStreams[port];
+	LOG_DEBUG_STR("handleDataStream:in=" << stream.inPtr << ", out=" << stream.outPtr);
+	int	newBytes = stream.socket->recv(stream.buffer + stream.inPtr, itsBufferSize - stream.inPtr);
+	LOG_DEBUG_STR("received " << newBytes << " new bytes");
+	if (newBytes < 0) {
+//		LOG_ERROR_STR("read on socket " << sid << " returned " << newBytes << ". Closing connection");
+		free (stream.buffer);
+		stream.socket->close();
+		free(stream.socket);
+		itsLogStreams.erase(port);
+		return;
+	}
+//	LOG_DEBUG_STR("Received " << newBytes << " bytes at sid " << sid);
+	stream.inPtr += newBytes;
+	
+	// process as much data as possible from the buffer.
+	for (int i = stream.outPtr; i <= stream.inPtr; i++) {
+		if (stream.buffer[i] != '\n') {
+			continue;
+		}
+
+		stream.buffer[i] = '\0';
+//		LOG_INFO(formatString("SID %d:>%s<", sid, &(stream.buffer[stream.outPtr])));
+		LOG_INFO(formatString("(%d,%d)>%s<", stream.outPtr, i, &(stream.buffer[stream.outPtr])));
+		_processLogLine(&(stream.buffer[stream.outPtr]));
+		stream.outPtr = i+1;
+		if (stream.outPtr >= stream.inPtr) {	// All received bytes handled?
+			LOG_DEBUG("Reset of read/write pointers");
+			stream.inPtr = 0;
+			stream.outPtr = 0;
+			itsLogStreams[port] = stream;	// copy changes back to admin
+			return;
+		} 
+	}
+
+	if (stream.outPtr > (int)(0.5*itsBufferSize)) {
+		// When buffer becomes full shift leftovers to the left.
+		LOG_DEBUG_STR("move with: " << stream.inPtr << ", " << stream.outPtr);
+		memmove (stream.buffer, stream.buffer + stream.outPtr, (stream.inPtr - stream.outPtr + 1));
+		stream.inPtr -= stream.outPtr;
+		stream.outPtr = 0;
+	}
+
+	itsLogStreams[port] = stream; // copy changes back to admin
+}
+
+//
+// _getProcessID(char*)
+//
+string BGPlogProcessor::_getProcessID(char*	cString)
+{
+	char	delimiter[]="|";
+	char*	result = strtok(cString, delimiter);	// get loglevel
+	if (!result) {		// unknown line skip it.
+		LOG_DEBUG("No loglevel found");
+		return ("");
+	}
+
+	if (!(result = strtok(NULL, delimiter))) {		// get processID
+		LOG_DEBUG("No processID found");
+		return ("");
+	}
+	
+	return (result);
+}
+
+
+//
+// _processLogLine(char*)
+//
+void BGPlogProcessor::_processLogLine(char*		cString)
+{
+	string processName(_getProcessID(cString));
+	LOG_DEBUG_STR("Processname=" << processName);
+	if (processName.empty()) {
+		return;
+	}
+
+	// TODO: switch on processName to right analysis routine
+
+	char*	logMsg = strtok(NULL, "|");
+	char*	result;
+
+	if ((result = strstr(logMsg, " late: "))) {
+		float	late;
+		sscanf(result, " late: %f ", &late);	// TODO check result
+		LOG_DEBUG_STR("Late: " << late);
+	}
+	else if ((result = strstr(logMsg, "ION->CN:"))) {
+		float	ioTime;
+		sscanf(result, "ION->CN:%f", &ioTime);	// TODO check result
+		LOG_DEBUG_STR("ioTime: " << ioTime);
+	}
+	else if ((result = strstr(logMsg, "received ["))) {
+		int	blocks0(0), blocks1(0), blocks2(0), blocks3(0);
+		sscanf(result, "received [%d,%d,%d,%d]", &blocks0, &blocks1, &blocks2, &blocks3);	// TODO check result
+		LOG_DEBUG(formatString("blocks: %d, %d, %d, %d", blocks0, blocks1, blocks2, blocks3));
+	}
+}
+
+  } // namespace APL
+} // namespace LOFAR
diff --git a/MAC/APL/CEPCU/src/BGPlogProcessor/BGPlogProcessor.conf b/MAC/APL/CEPCU/src/BGPlogProcessor/BGPlogProcessor.conf
new file mode 100644
index 0000000000000000000000000000000000000000..49b98e69176624c578c54b4509b8209f4210750a
--- /dev/null
+++ b/MAC/APL/CEPCU/src/BGPlogProcessor/BGPlogProcessor.conf
@@ -0,0 +1,5 @@
+#
+# Parameter file for CEPlogProcessor
+#
+BGPlogProcessor.portNr		=	24500
+BGPlogProcessor.bufferSize	=	1024
diff --git a/MAC/APL/CEPCU/src/BGPlogProcessor/BGPlogProcessor.h b/MAC/APL/CEPCU/src/BGPlogProcessor/BGPlogProcessor.h
new file mode 100644
index 0000000000000000000000000000000000000000..4de11d41b9561cbd5d4815436c7b30d59ec7a6c6
--- /dev/null
+++ b/MAC/APL/CEPCU/src/BGPlogProcessor/BGPlogProcessor.h
@@ -0,0 +1,92 @@
+//#  BGPlogProcessor.h: Daemon for catching CEP cout log streams
+//#
+//#  Copyright (C) 2009
+//#  ASTRON (Netherlands Foundation for Research in Astronomy)
+//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//#  This program 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.
+//#
+//#  This program 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 this program; if not, write to the Free Software
+//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//#  Note: This source is read best with tabstop 4.
+//#
+//#  $Id$
+
+#ifndef LOFAR_APL_BGPLOGPROCESSOR_H
+#define LOFAR_APL_BGPLOGPROCESSOR_H
+
+// \file
+// Daemon for launching Application Controllers
+
+//# Never #include <config.h> or #include <lofar_config.h> in a header file!
+//# Includes
+#include <GCF/TM/GCF_Control.h>
+
+namespace LOFAR {
+  using GCF::TM::GCFTask;
+  using GCF::TM::GCFTCPPort;
+  using GCF::TM::GCFPortInterface;
+  namespace APL {
+// \addtogroup CEPCU
+// @{
+
+
+// The BGPlogProcessor class implements a small daemon that ...
+class BGPlogProcessor : public GCFTask
+{
+public:
+	// Creates an BGPlogProcessor object that start listening on the port mentioned
+	// in the ParameterSet.
+	explicit BGPlogProcessor(const string&	progName);
+
+	// Destructor.
+	~BGPlogProcessor();
+
+	// its processing states
+	GCFEvent::TResult startListener(GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult operational  (GCFEvent& e, GCFPortInterface& p);
+	
+private:
+	// Copying is not allowed
+	BGPlogProcessor(const BGPlogProcessor&	that);
+	BGPlogProcessor& operator=(const BGPlogProcessor& that);
+
+	void	_handleConnectionRequest();
+	void	_handleDataStream(GCFPortInterface*	port);
+	string	_getProcessID	 (char*	cString);
+	void 	_processLogLine  (char*	cString);
+
+	//# --- Datamembers --- 
+	// The listener socket to receive the requests on.
+	GCFTCPPort*		itsListener;
+
+	// internal structure for admin for 1 stream
+	typedef struct {
+		GCFTCPPort*	socket;
+		char*		buffer;
+		int			inPtr;
+		int			outPtr;
+	} streamBuffer_t;
+
+	// Map containing all the streambuffers.
+	map<GCFPortInterface*, streamBuffer_t>	itsLogStreams;
+
+	// buffersize of the streambuffers.
+	int		itsBufferSize;
+};
+
+// @} addgroup
+  } // namespace APL
+} // namespace LOFAR
+
+#endif
diff --git a/MAC/APL/CEPCU/src/BGPlogProcessor/BGPlogProcessorMain.cc b/MAC/APL/CEPCU/src/BGPlogProcessor/BGPlogProcessorMain.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8349db8ff4f3db591e3f62637ca66125ac001012
--- /dev/null
+++ b/MAC/APL/CEPCU/src/BGPlogProcessor/BGPlogProcessorMain.cc
@@ -0,0 +1,59 @@
+//#  BGPlogProcessorMain.cc: Deamon to dispatch the BG/P logging to PVSS
+//#
+//#  Copyright (C) 2009
+//#  ASTRON (Netherlands Foundation for Research in Astronomy)
+//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//#  This program 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.
+//#
+//#  This program 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 this program; if not, write to the Free Software
+//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//#  $Id$
+
+//# Always #include <lofar_config.h> first!
+#include <lofar_config.h>
+
+//# Includes
+#include <Common/LofarLogger.h>
+#include <Common/LofarLocators.h>
+#include <GCF/TM/GCF_Scheduler.h>
+#include "BGPlogProcessor.h"
+
+using namespace LOFAR;
+using namespace GCF::TM;
+using namespace LOFAR::APL;
+
+//
+// MAIN (parameterfile)
+//
+int main (int argc, char* argv[]) 
+{
+	try {
+		GCFScheduler::instance()->init(argc, argv);
+
+		BGPlogProcessor		loggerTask("BGPlogger");
+		loggerTask.start(); // make initial transition
+
+		GCFScheduler::instance()->run();
+
+		LOG_INFO_STR("Shutting down: " << argv[0]);
+	}
+	catch (LOFAR::Exception&	ex) {
+		LOG_FATAL_STR("Caught exception: " << ex);
+		LOG_FATAL     ("Terminated by exception!");
+		return (1);
+	}
+
+	LOG_INFO("Terminated normally");
+	return (0);
+}
diff --git a/MAC/APL/CEPCU/src/BGPlogProcessor/Makefile.am b/MAC/APL/CEPCU/src/BGPlogProcessor/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..5d69c4449af2346f6674e732be60c7c9f67c7b55
--- /dev/null
+++ b/MAC/APL/CEPCU/src/BGPlogProcessor/Makefile.am
@@ -0,0 +1,15 @@
+
+bin_PROGRAMS			= BGPlogProcessor
+
+sysconf_DATA			= BGPlogProcessor.conf
+
+BGPlogProcessorHEADERS	= BGPlogProcessor.h
+
+noinst_HEADERS 			= $(BGPlogProcessorHEADERS)
+
+BGPlogProcessor_SOURCES			= BGPlogProcessor.cc \
+								  BGPlogProcessorMain.cc
+BGPlogProcessor_DEPENDENCIES	= $(LOFAR_DEPEND) $(BGPlogProcessorHEADERS)
+BGPlogProcessor_LDADD       	=
+
+include $(top_srcdir)/Makefile.common
diff --git a/MAC/APL/CEPCU/src/Makefile.am b/MAC/APL/CEPCU/src/Makefile.am
index dfc5968928c3ec6f4de9f751c0760796c179f778..45f37006a1474448f6e5559c2ee952090564c62a 100644
--- a/MAC/APL/CEPCU/src/Makefile.am
+++ b/MAC/APL/CEPCU/src/Makefile.am
@@ -1,6 +1,6 @@
 pkginclude_HEADERS = Package__Version.h
 
-SUBDIRS = ApplController CEPlogProcessor 
+SUBDIRS = ApplController CEPlogProcessor BGPlogProcessor
 if HAVE_PVSS
   SUBDIRS += OnlineControl # OfflineControl 
 endif
diff --git a/MAC/APL/CEPCU/src/OnlineControl/CEPApplMgr.cc b/MAC/APL/CEPCU/src/OnlineControl/CEPApplMgr.cc
index 152364e68268f564a1b187a422c258675d822922..f2b50def6608296b7766d3cf48fb7f3a66ef8354 100644
--- a/MAC/APL/CEPCU/src/OnlineControl/CEPApplMgr.cc
+++ b/MAC/APL/CEPCU/src/OnlineControl/CEPApplMgr.cc
@@ -23,9 +23,11 @@
 #include <lofar_config.h>
 #include <Common/StringUtil.h>
 #include <APL/APLCommon/Controller_Protocol.ph>
+#include <GCF/TM/GCF_Scheduler.h>
 #include "CEPApplMgr.h"
 
 namespace LOFAR {
+  using namespace GCF::TM;
   using namespace ACC::ALC;
   using namespace APLCommon;
   namespace CEPCU {
@@ -56,7 +58,7 @@ CEPApplMgr::CEPApplMgr(CEPApplMgrInterface& interface,
 //
 CEPApplMgr::~CEPApplMgr()
 {
-	GCFTask::deregisterHandler(*this);
+	GCFScheduler::instance()->deregisterHandler(*this);
 }
 
 //
diff --git a/MAC/APL/CEPCU/src/OnlineControl/OnlineControl.cc b/MAC/APL/CEPCU/src/OnlineControl/OnlineControl.cc
index a3e59369cb1f14cd826de94361f68506b46fba63..6787f2f3ef81b135e5178583c0493842fce8f69d 100644
--- a/MAC/APL/CEPCU/src/OnlineControl/OnlineControl.cc
+++ b/MAC/APL/CEPCU/src/OnlineControl/OnlineControl.cc
@@ -512,7 +512,7 @@ GCFEvent::TResult OnlineControl::finishing_state(GCFEvent& event, GCFPortInterfa
 	}
 
 	case F_TIMER:
-		GCFTask::stop();
+		GCFScheduler::instance()->stop();
 		break;
 
 	default:
diff --git a/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc b/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc
index aca7434ed4b7c61609fb06976fadaf364b89bca7..fa0eef0178a4e10f170977139d3073dd0681b746 100644
--- a/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc
+++ b/MAC/APL/CEPCU/src/OnlineControl/OnlineControlMain.cc
@@ -37,7 +37,7 @@ int main(int argc, char* argv[])
 		return(-1);
 	}
 
-	GCFTask::init(argc, argv, "OnlineControl");
+	GCFScheduler::instance()->init(argc, argv, "OnlineControl");
 
 	ParentControl*	pc = ParentControl::instance();
 	pc->start();	// make initial transition
@@ -45,7 +45,7 @@ int main(int argc, char* argv[])
 	OnlineControl	olc(argv[1]);
 	olc.start(); 	// make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return (0);
 }
diff --git a/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc b/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc
index f779071bfc6d74d72c46d7e1bdd6e967f6dad5a6..e6f39a6ecdbe63373bf38dc3235b8b9183ab177c 100644
--- a/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc
+++ b/MAC/APL/CUDaemons/src/CTStartDaemon/CTStartDaemonMain.cc
@@ -31,7 +31,7 @@ int main(int argc, char* argv[])
 {
 //	signal (SIGCHLD, SIG_IGN);
 
-	GCFTask::init(argc, argv, "CTStartDaemon");
+	GCFScheduler::instance()->init(argc, argv, "CTStartDaemon");
 
 	LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_CTStartDaemon");
 
@@ -39,7 +39,7 @@ int main(int argc, char* argv[])
 
 	sd.start(); // make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/APL/CUDaemons/src/LogClient/LogClientMain.cc b/MAC/APL/CUDaemons/src/LogClient/LogClientMain.cc
index 453b09cc4f6bb3ef2537db783303cbc77e245fe8..ca479eb9473d5cfe6256b79ee1bb84df8a363d6a 100644
--- a/MAC/APL/CUDaemons/src/LogClient/LogClientMain.cc
+++ b/MAC/APL/CUDaemons/src/LogClient/LogClientMain.cc
@@ -30,14 +30,14 @@ using namespace LOFAR::CUDaemons;
 
 int main(int argc, char *argv[])
 {
-	GCFTask::init(argc, argv, "LogClient");
+	GCFScheduler::instance()->init(argc, argv, "LogClient");
 
 //	LOG_INFO("MACProcessScope: LOFAR_PermSW_LogClient");
 
 	LogClient LC("LogClient"); 
 	LC.start(); // make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return (0);
 }
diff --git a/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc b/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc
index b8adbf007128bfd9c8ee5087e64ab0a4b65193ff..ad70a6ec8962caffb07e67c44c7c67b430c09ce6 100644
--- a/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc
+++ b/MAC/APL/CUDaemons/src/ServiceBroker/ServiceBrokerMain.cc
@@ -32,7 +32,7 @@ using namespace LOFAR::CUDaemons;
 
 int main(int argc, char *argv[])
 {
-  GCFTask::init(argc, argv, "ServiceBroker");
+  GCFScheduler::instance()->init(argc, argv, "ServiceBroker");
   
   LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_ServiceBroker");
 
@@ -40,7 +40,7 @@ int main(int argc, char *argv[])
   
   sb.start(); // make initial transition
   
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 
   return 0;
 }
diff --git a/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLogger.h b/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLogger.h
index 11ce7cebbc8715357c41f8e707d50fb44d614fbb..7cd767b924e70ef6c64a605ddfc11d13e31dec38 100644
--- a/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLogger.h
+++ b/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLogger.h
@@ -39,7 +39,7 @@
 // Avoid 'using namespace' in headerfiles
 
 namespace LOFAR {
-  using namespace MACIO;
+  using MACIO::GCFEvent;
   namespace GCF {  
     namespace RTDBDaemons {
 
@@ -65,9 +65,9 @@ private:
 	GCFEvent::TResult operational (GCFEvent& e, TM::GCFPortInterface& p);
 
 	// helper methods
-	void	_registerClient(GCFPortInterface&	port,
+	void	_registerClient(TM::GCFPortInterface&	port,
 						    const string&		name, uint32		obsID);
-	void    _registerFailure(GCFPortInterface&	port);
+	void    _registerFailure(TM::GCFPortInterface&	port);
 
 	// data members        
 	TM::GCFTCPPort*			itsListener;	// application inpt
diff --git a/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc b/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc
index 0472c5869d92178bb4be4d8ebf25b602b9241fe3..d6bbc92522ec700dac8d775acb9017f885bf5985 100644
--- a/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc
+++ b/MAC/APL/CURTDBDaemons/src/KeyValueLogger/KeyValueLoggerMain.cc
@@ -30,13 +30,13 @@ using namespace LOFAR::GCF::RTDBDaemons;
 
 int main(int argc, char *argv[])
 {
-	GCFTask::init(argc, argv, "KeyValueLogger");
+	GCFScheduler::instance()->init(argc, argv, "KeyValueLogger");
 	LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_KVLogger");
 
 	KeyValueLogger kvl("KeyValueLogger"); 
 	kvl.start(); // make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return (0);
 }
diff --git a/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessor.cc b/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessor.cc
index 788f05617d3701177f24d7ffe76149a9cd528053..48e5cf2df225230efac69a3d59d2a7e792a46eb5 100644
--- a/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessor.cc
+++ b/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessor.cc
@@ -175,10 +175,12 @@ GCFEvent::TResult LogProcessor::operational(GCFEvent&			event,
 		if (&port == itsListener) {
 			client->init(*this, "application", GCFPortInterface::SPP, 0, true);
 			itsListener->accept(*client);
+			LOG_DEBUG("New connection with an application");
 		}
 		if (&port == itsBackDoor) {
 			client->init(*this, "LogClient", GCFPortInterface::SPP, LOG_PROTOCOL);
 			itsBackDoor->accept(*client);
+			LOG_DEBUG("New connection with a LogCLient");
 		}
 	}
 	break;
@@ -242,6 +244,7 @@ GCFEvent::TResult LogProcessor::operational(GCFEvent&			event,
 
 		// Construct an InternalLoggingEvent from the buffer
 		spi::InternalLoggingEvent l4cpLogEvent = readFromBuffer(buffer);           
+		LOG_TRACE_RTTI_STR("IN:" << l4cpLogEvent.getMessage());
 
 		// Has client a known DP?
 		string 	PVSSdp(_searchClientDP(l4cpLogEvent, port));
diff --git a/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessor.h b/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessor.h
index 7081e50fde3ac0e50e82b0c0b123815e85b9a415..945270eaf233da0c1572338252064e0ca29dcdc5 100644
--- a/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessor.h
+++ b/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessor.h
@@ -39,7 +39,7 @@
 // Avoid 'using namespace' in headerfiles
 
 namespace LOFAR {
-  using namespace MACIO;
+  using MACIO::GCFEvent;
   namespace GCF {  
     namespace RTDBDaemons {
 
@@ -58,8 +58,8 @@ private:
 	bool _readFromPortData(TM::GCFPortInterface& 				port, 
 						   log4cplus::helpers::SocketBuffer&	buf);
 	string _searchClientDP(log4cplus::spi::InternalLoggingEvent&	logEvent,
-						   GCFPortInterface&						port);
-	void _registerFailure (GCFPortInterface&	port);
+						   TM::GCFPortInterface&						port);
+	void _registerFailure (TM::GCFPortInterface&	port);
 
 	// data members        
 	TM::GCFTCPPort*			itsListener;	// application inpt
diff --git a/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc b/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc
index cfa79d6ce8d13983ec8f13c6a83943819543dc08..a8bb97daa5850d3cd72590142fd262e0c13b5cd6 100644
--- a/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc
+++ b/MAC/APL/CURTDBDaemons/src/LogProcessor/LogProcessorMain.cc
@@ -30,13 +30,13 @@ using namespace LOFAR::GCF::RTDBDaemons;
 
 int main(int argc, char *argv[])
 {
-	GCFTask::init(argc, argv, "LogProcessor");
+	GCFScheduler::instance()->init(argc, argv, "LogProcessor");
 //	LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_LogProcessor");
 
 	LogProcessor clp("LogProcessor"); 
 	clp.start(); // make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return (0);
 }
diff --git a/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc b/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc
index a0c08340ea7dcb6eea4839b1d54f211ac9cd70f3..34035d6f653784a59d91223525815ee239b60237 100644
--- a/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc
+++ b/MAC/APL/CURTDBDaemons/src/SASGateway/SASGatewayMain.cc
@@ -30,13 +30,13 @@ using namespace LOFAR::GCF::RTDBDaemons;
 
 int main(int argc, char *argv[])
 {
-	GCFTask::init(argc, argv, "SASGateway");
+	GCFScheduler::instance()->init(argc, argv, "SASGateway");
 	LOG_INFO("MACProcessScope: LOFAR_PermSW_Daemons_SASGateway");
 
 	SASGateway SGW("SASGateway"); 
 	SGW.start(); // make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return (0);
 }
diff --git a/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitor.h b/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitor.h
index 8ccf6d72c6e4092d806ede0d48a672cfe8dda5b0..c87dec0633ab68dfb2dc3ab39d4703e267363a9c 100644
--- a/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitor.h
+++ b/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitor.h
@@ -39,6 +39,7 @@ namespace LOFAR {
 	using	MACIO::GCFEvent;
 	using	GCF::TM::GCFTimerPort;
 	using	GCF::TM::GCFTCPPort;
+	using	GCF::TM::GCFITCPort;
 	using	GCF::TM::GCFPortInterface;
 	using	GCF::TM::GCFTask;
 	using	GCF::RTDB::RTDBPropertySet;
diff --git a/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc b/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc
index e1cd9070652581e7ab06992307633ec9b6253a59..01485d93388c65af80502548a3d3bb3aebd7bb05 100644
--- a/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc
+++ b/MAC/APL/CURTDBDaemons/src/SoftwareMonitor/SoftwareMonitorMain.cc
@@ -37,7 +37,7 @@ using namespace LOFAR::RTDBDaemons;
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
-	GCFTask::init(argc, argv, "SoftwareMonitor");
+	GCFScheduler::instance()->init(argc, argv, "SoftwareMonitor");
 
 	LOG_INFO("MACProcessScope: LOFAR_PermSW_SoftwareMonitor");
 	LOG_INFO(Version::getInfo<CURTDBDaemonsVersion>("SoftwareMonitor"));
@@ -51,13 +51,13 @@ int main(int argc, char* argv[])
 	swm->start();
 
 	// ok, we have something to do, do it.
-	GCFTask::setDelayedQuit(true);	// we need a clean shutdown
-	GCFTask::run();	// until stop was called
+	GCFScheduler::instance()->setDelayedQuit(true);	// we need a clean shutdown
+	GCFScheduler::instance()->run();	// until stop was called
 
 	swm->quit();		// let task quit nicely
 
 	double	postRunTime = globalParameterSet()->getDouble("closingDelay", 1.5);
-	GCFTask::run(postRunTime);	// let processes die.
+	GCFScheduler::instance()->run(postRunTime);	// let processes die.
 
 	return (0);
 }
diff --git a/MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc b/MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc
index af3dbb4d1b982ab9c374d9f677e0a07231e5a762..910ac3044ce5d575a73f18c3333d456a046a5aa1 100644
--- a/MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc
+++ b/MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc
@@ -513,7 +513,7 @@ GCFEvent::TResult MACScheduler::finishing_state(GCFEvent& event, GCFPortInterfac
 	}
   
     case F_TIMER:
-      GCFTask::stop();
+      GCFScheduler::instance()->stop();
       break;
     
 	default:
diff --git a/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc b/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc
index d20a78047c7b5b266dde9c4ed16839937c363f31..0c1669797489954a366cb23351cd9294c242486c 100644
--- a/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc
+++ b/MAC/APL/MainCU/src/MACScheduler/MACSchedulerMain.cc
@@ -31,7 +31,7 @@ using namespace LOFAR::APLCommon;
 
 int main(int argc, char* argv[])
 {
-	GCFTask::init(argc, argv, "MACScheduler");
+	GCFScheduler::instance()->init(argc, argv, "MACScheduler");
 
 	ChildControl*	cc = ChildControl::instance();
 	cc->start();	// make initial transition
@@ -39,7 +39,7 @@ int main(int argc, char* argv[])
 	MACScheduler	ms;
 	ms.start(); // make initial transition
   
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/APL/MainCU/src/MACScheduler/ObsClaimer.h b/MAC/APL/MainCU/src/MACScheduler/ObsClaimer.h
index db6975998c2205bd8ff4487e0651c15ad29dfd18..4b2efec4dca432d863354b92d6a0dbffa83d0068 100644
--- a/MAC/APL/MainCU/src/MACScheduler/ObsClaimer.h
+++ b/MAC/APL/MainCU/src/MACScheduler/ObsClaimer.h
@@ -43,6 +43,7 @@
 
 namespace LOFAR {
 	using	MACIO::GCFEvent;
+	using	GCF::TM::GCFITCPort;
 	using	GCF::TM::GCFTimerPort;
 	using	GCF::TM::GCFPortInterface;
 	using	GCF::TM::GCFTask;
diff --git a/MAC/APL/MainCU/src/ObservationControl/ObservationControl.cc b/MAC/APL/MainCU/src/ObservationControl/ObservationControl.cc
index 4093a4bbc1b78402e024270bb71c19568d4f1a67..f5c00bcafbd0f3b73c7a45067ae873ef310f719b 100644
--- a/MAC/APL/MainCU/src/ObservationControl/ObservationControl.cc
+++ b/MAC/APL/MainCU/src/ObservationControl/ObservationControl.cc
@@ -578,7 +578,7 @@ GCFEvent::TResult ObservationControl::finishing_state(GCFEvent& 		event,
 	}
   
     case F_TIMER:
-      GCFTask::stop();
+      GCFScheduler::instance()->stop();
       break;
     
 	default:
diff --git a/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc b/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc
index 53edb161c67ee2113a48ca54785e46868b23d9ec..367967ec07b6fb14c07452ea417342cbd2412a1f 100644
--- a/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc
+++ b/MAC/APL/MainCU/src/ObservationControl/ObservationControlMain.cc
@@ -32,7 +32,7 @@ using namespace LOFAR::APLCommon;
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
-	GCFTask::init(argc, argv, argv[1]);
+	GCFScheduler::instance()->init(argc, argv, argv[1]);
 
 	ChildControl*	cc = ChildControl::instance();
 	cc->start();	// make initial transition
@@ -43,7 +43,7 @@ int main(int argc, char* argv[])
 	ObservationControl	oc(argv[1]);
 	oc.start(); // make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/APL/PAC/BeamServer/src/BeamServer.cc b/MAC/APL/PAC/BeamServer/src/BeamServer.cc
index be4f6d48825126cc26e671309300a6fa36f24554..6cc71edcaf4be1cb3a2181d95300c39fab4508e9 100644
--- a/MAC/APL/PAC/BeamServer/src/BeamServer.cc
+++ b/MAC/APL/PAC/BeamServer/src/BeamServer.cc
@@ -1060,7 +1060,7 @@ GCFEvent::TResult BeamServer::recall(GCFPortInterface& /*p*/)
 		LOG_DEBUG_STR(">>> recalling event " << m_deferred_queue.size() << " <<<");
 		pair<char*, GCFPortInterface*> port_event = m_deferred_queue.front();
 		m_deferred_queue.pop_front();
-		status = dispatch(*(GCFEvent*)(port_event.first), *port_event.second);
+		status = doEvent(*(GCFEvent*)(port_event.first), *port_event.second);
 		delete [] port_event.first;
 	}
 	else {
diff --git a/MAC/APL/PAC/BeamServer/src/BeamServer.h b/MAC/APL/PAC/BeamServer/src/BeamServer.h
index 8eea36fd88584e338af8b69a5fcc702c039ff43b..025bf3637d70a6a037d96eb763091a7f09773a83 100644
--- a/MAC/APL/PAC/BeamServer/src/BeamServer.h
+++ b/MAC/APL/PAC/BeamServer/src/BeamServer.h
@@ -38,6 +38,11 @@
 #include <list>
 
 namespace LOFAR {
+  using GCF::TM::GCFTask;
+  using GCF::TM::GCFPort;
+  using GCF::TM::GCFTCPPort;
+  using GCF::TM::GCFTimerPort;
+  using GCF::TM::GCFPortInterface;
   namespace BS {
 
 extern	int		g_bf_gain;
diff --git a/MAC/APL/PAC/BeamServer/src/BeamServerMain.cc b/MAC/APL/PAC/BeamServer/src/BeamServerMain.cc
index 990973d42995537fa779c322fd74558a6e363b4a..b7a235feb9bd744e33067a4f7ec14c5c0f7e4775 100644
--- a/MAC/APL/PAC/BeamServer/src/BeamServerMain.cc
+++ b/MAC/APL/PAC/BeamServer/src/BeamServerMain.cc
@@ -51,7 +51,7 @@ int main(int argc, char* argv[])
 		}
 	}
 
-	GCFTask::init(argc, argv, "BeamServer");
+	GCFScheduler::instance()->init(argc, argv, "BeamServer");
 
 	LOG_INFO("MACProcessScope: LOFAR_PermSW_BeamServer");
 	LOG_INFO(formatString("Program %s has started", argv[0]));
@@ -73,7 +73,7 @@ int main(int argc, char* argv[])
 
 		beamserver.start(); // make initial transition
 
-		GCFTask::run();
+		GCFScheduler::instance()->run();
 	}
 	catch (Exception& e) {
 		LOG_FATAL_STR("Exception: " << e.text());
diff --git a/MAC/APL/PAC/BeamServer/src/beamctl.cc b/MAC/APL/PAC/BeamServer/src/beamctl.cc
index e11a0440059a0005a692c5caaa540c8c466e5452..0a294c4309cb8ba5b2bbfd2f799e31b1a00455f8 100644
--- a/MAC/APL/PAC/BeamServer/src/beamctl.cc
+++ b/MAC/APL/PAC/BeamServer/src/beamctl.cc
@@ -26,6 +26,7 @@
 #include <APL/BS_Protocol/BS_Protocol.ph>
 #include <APL/RSP_Protocol/RCUSettings.h>
 #include <MACIO/MACServiceInfo.h>
+#include <GCF/TM/GCF_Control.h>
 #include <Common/LofarLocators.h>
 #include <Common/ParameterSet.h>
 
@@ -71,6 +72,7 @@ using namespace BS;
 using namespace RTC;
 using namespace CAL_Protocol;
 using namespace BS_Protocol;
+using namespace GCF::TM;
 
 beamctl::beamctl(string name,
 		 string parent,
@@ -347,7 +349,7 @@ GCFEvent::TResult beamctl::final(GCFEvent& e, GCFPortInterface& /*port*/)
   switch(e.signal)
   {
       case F_ENTRY:
-	  GCFTask::stop();
+	  GCFScheduler::instance()->stop();
 	  break;
       
       case F_EXIT:
@@ -470,7 +472,7 @@ static list<int> strtolist(const char* str, int max)
 void beamctl::mainloop()
 {
   start(); // make initial transition
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 }
 
 int main(int argc, char** argv)
@@ -669,7 +671,7 @@ int main(int argc, char** argv)
   }
 
   cout << "Argument are ok, creating a task" << endl;
-  GCFTask::init(argc, argv, "beamctl");
+  GCFScheduler::instance()->init(argc, argv, "beamctl");
   LOG_INFO(formatString("Program %s has started", argv[0]));
 
   beamctl ctl("beamctl", array, rcus, subbands, beamlets, rcumode, longitude, latitude, type);
diff --git a/MAC/APL/PAC/BeamServer/src/beamctl.h b/MAC/APL/PAC/BeamServer/src/beamctl.h
index 319d698988c0ffb72180afbec2f0dc9ca0e96cda..16d5b9eb0a5497395baffc90bbf21764f5221d7e 100644
--- a/MAC/APL/PAC/BeamServer/src/beamctl.h
+++ b/MAC/APL/PAC/BeamServer/src/beamctl.h
@@ -32,10 +32,11 @@
 #include <APL/RSP_Protocol/RCUSettings.h>
 #include <APL/BS_Protocol/BS_Protocol.ph>
 
-namespace LOFAR
-{
-  namespace BS
-    {
+namespace LOFAR {
+  using GCF::TM::GCFTask;
+  using GCF::TM::GCFPort;
+  using GCF::TM::GCFPortInterface;
+  namespace BS {
 
       class beamctl : public GCFTask
 	{
diff --git a/MAC/APL/PAC/BeamServer/test/AVTStub.cc b/MAC/APL/PAC/BeamServer/test/AVTStub.cc
index 28cb7364953920c23486d2cdf74b968e56b53949..74c4ace763999619a7c320a2a4531b579185e72f 100644
--- a/MAC/APL/PAC/BeamServer/test/AVTStub.cc
+++ b/MAC/APL/PAC/BeamServer/test/AVTStub.cc
@@ -601,7 +601,7 @@ GCFEvent::TResult AVTStub::done(GCFEvent& e, GCFPortInterface& /*port*/)
   switch(e.signal)
   {
   case F_ENTRY:
-    GCFTask::stop();
+    GCFScheduler::instance()->stop();
     break;
   }
 
@@ -611,12 +611,12 @@ GCFEvent::TResult AVTStub::done(GCFEvent& e, GCFPortInterface& /*port*/)
 void AVTStub::run()
 {
   start(); // make initial transition
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 }
 
 int main(int argc, char** argv)
 {
-  GCFTask::init(argc, argv);
+  GCFScheduler::instance()->init(argc, argv);
 
   LOG_INFO(formatString("Program %s has started", argv[0]));
 
diff --git a/MAC/APL/PAC/BeamServer/test/BeamServerTest.cc b/MAC/APL/PAC/BeamServer/test/BeamServerTest.cc
index c60f5b96af7c5f0911cafc6d6eb4d814e383a9fb..ee710a39124fbf19373730c7c23eeffc17c96c4a 100644
--- a/MAC/APL/PAC/BeamServer/test/BeamServerTest.cc
+++ b/MAC/APL/PAC/BeamServer/test/BeamServerTest.cc
@@ -328,7 +328,7 @@ public:
 
 int main(int argc, char** argv)
 {
-	GCFTask::init(argc, argv);
+	GCFScheduler::instance()->init(argc, argv);
 
 	LOG_INFO(formatString("Program %s has started", argv[0]));
 
diff --git a/MAC/APL/PAC/BeamServer/test/EPATest.cc b/MAC/APL/PAC/BeamServer/test/EPATest.cc
index 617d0685cf53c46c21d22648e8b93984e576980a..69467dcd702f654b405f92bb8af1c6084103e6f6 100644
--- a/MAC/APL/PAC/BeamServer/test/EPATest.cc
+++ b/MAC/APL/PAC/BeamServer/test/EPATest.cc
@@ -239,7 +239,7 @@ GCFEvent::TResult EPATest::done(GCFEvent& e, GCFPortInterface& /*port*/)
   switch(e.signal)
   {
   case F_ENTRY:
-    GCFTask::stop();
+    GCFScheduler::instance()->stop();
     break;
   }
 
@@ -249,12 +249,12 @@ GCFEvent::TResult EPATest::done(GCFEvent& e, GCFPortInterface& /*port*/)
 void EPATest::run()
 {
   start(); // make initial transition
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 }
 
 int main(int argc, char** argv)
 {
-  GCFTask::init(argc, argv);
+  GCFScheduler::instance()->init(argc, argv);
 
   if (argc != 4) {
     cerr << "usage: EPATest subarrayname startbeamlet nbeamlets" << endl;
diff --git a/MAC/APL/PAC/BeamServer/test/SweepTest.cc b/MAC/APL/PAC/BeamServer/test/SweepTest.cc
index 200e804541da5d3386b8c7b9c8cc0388dbb64f45..df32b970fdb7503774b9f06277387f739b971071 100644
--- a/MAC/APL/PAC/BeamServer/test/SweepTest.cc
+++ b/MAC/APL/PAC/BeamServer/test/SweepTest.cc
@@ -230,7 +230,7 @@ GCFEvent::TResult SweepTest::done(GCFEvent& e, GCFPortInterface& /*port*/)
   switch(e.signal)
   {
   case F_ENTRY:
-    GCFTask::stop();
+    GCFScheduler::instance()->stop();
     break;
   }
 
@@ -240,13 +240,13 @@ GCFEvent::TResult SweepTest::done(GCFEvent& e, GCFPortInterface& /*port*/)
 void SweepTest::run()
 {
   start(); // make initial transition
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 }
 
 int main(int argc, char** argv)
 {
   LOG_INFO(formatString("Program %s has started", argv[0]));
-  GCFTask::init(argc, argv);
+  GCFScheduler::instance()->init(argc, argv);
 
   cout << "Subband index to plot: ";
   char buf[32];
diff --git a/MAC/APL/PAC/CalServer/src/ACMProxy.cc b/MAC/APL/PAC/CalServer/src/ACMProxy.cc
index 3a0868919d6d69fb1299523fcf48852afc0220ab..f1f2e236adaedc6c4191672ebdc5e39709844eb2 100644
--- a/MAC/APL/PAC/CalServer/src/ACMProxy.cc
+++ b/MAC/APL/PAC/CalServer/src/ACMProxy.cc
@@ -42,6 +42,7 @@ using namespace LOFAR;
 using namespace RSP_Protocol;
 using namespace CAL;
 using namespace RTC;
+using namespace GCF::TM;
 
 #define START_DELAY 4
 
diff --git a/MAC/APL/PAC/CalServer/src/ACMProxy.h b/MAC/APL/PAC/CalServer/src/ACMProxy.h
index b6c0c46aaf29602c6c0f3c8560e77808a0481536..13043a08eeffe2d9a7424253b34f0ad86d613032 100644
--- a/MAC/APL/PAC/CalServer/src/ACMProxy.h
+++ b/MAC/APL/PAC/CalServer/src/ACMProxy.h
@@ -31,7 +31,10 @@
 #include <GCF/TM/GCF_Control.h>
 
 namespace LOFAR {
-typedef		void*		memptr_t;
+  using GCF::TM::GCFTask;
+  using GCF::TM::GCFPort;
+  using GCF::TM::GCFPortInterface;
+  typedef		void*		memptr_t;
   namespace CAL {
 
     class ACMProxy : public GCFTask
diff --git a/MAC/APL/PAC/CalServer/src/CalServer.cc b/MAC/APL/PAC/CalServer/src/CalServer.cc
index 9819f935ff2db372fea0b5077abca21344339941..4e6b2718c67ac071594edd2c99e2b3fa7a6d5563 100644
--- a/MAC/APL/PAC/CalServer/src/CalServer.cc
+++ b/MAC/APL/PAC/CalServer/src/CalServer.cc
@@ -66,6 +66,7 @@ using namespace CAL;
 using namespace RTC;
 using namespace RSP_Protocol;
 using namespace CAL_Protocol;
+using namespace GCF::TM;
 
 #define NPOL 2
 
@@ -869,7 +870,7 @@ int main(int argc, char** argv)
 		}
 	}
 
-	GCFTask::init(argc, argv, "CalServer");
+	GCFScheduler::instance()->init(argc, argv, "CalServer");
 
 	LOG_INFO("MACProcessScope: LOFAR_PermSW_CalServer");
 
@@ -896,7 +897,7 @@ int main(int argc, char** argv)
 		cal.start();      // make initial transition
 		acmproxy.start(); // make initial transition
 
-		GCFTask::run();
+		GCFScheduler::instance()->run();
 	}
 	catch (Exception& e) {
 		LOG_ERROR_STR("Exception: " << e.text());
diff --git a/MAC/APL/PAC/CalServer/src/CalServer.h b/MAC/APL/PAC/CalServer/src/CalServer.h
index a0d1ef9bf0b7be3a5d3241cf137b2a938737ca3c..04cbdb5f83adda70733f5bb324250cc0c5583abf 100644
--- a/MAC/APL/PAC/CalServer/src/CalServer.h
+++ b/MAC/APL/PAC/CalServer/src/CalServer.h
@@ -37,6 +37,10 @@
 #include <AMCBase/ConverterClient.h>
 
 namespace LOFAR {
+  using GCF::TM::GCFTask;
+  using GCF::TM::GCFPort;
+  using GCF::TM::GCFTCPPort;
+  using GCF::TM::GCFPortInterface;
   namespace CAL {
 
     class CalibrationAlgorithm;
diff --git a/MAC/APL/PAC/CalServer/src/SubArraySubscription.h b/MAC/APL/PAC/CalServer/src/SubArraySubscription.h
index 435ec4322442c3a238be13377ca380f77b58525c..88a9f13ca91cbff8e5cbc32150b907db2c157f4a 100644
--- a/MAC/APL/PAC/CalServer/src/SubArraySubscription.h
+++ b/MAC/APL/PAC/CalServer/src/SubArraySubscription.h
@@ -31,6 +31,7 @@
 #include <Common/lofar_bitset.h>
 
 namespace LOFAR {
+  using GCF::TM::GCFPortInterface;
   class RTC::Subject; // forward declaration
   namespace CAL {
     class SubArray; // forward declaration
diff --git a/MAC/APL/PAC/CalServer/src/calinfo.cc b/MAC/APL/PAC/CalServer/src/calinfo.cc
index 48311495dbc8dd65711b81a4f38f2dc5b9d7d780..dcd2c98d5228dcf3e005120690118b4345aa112a 100644
--- a/MAC/APL/PAC/CalServer/src/calinfo.cc
+++ b/MAC/APL/PAC/CalServer/src/calinfo.cc
@@ -121,7 +121,7 @@ GCFEvent::TResult	calinfo::getInfo(GCFEvent&	event, GCFPortInterface&	port)
 }
 
 GCFEvent::TResult	calinfo::finish(GCFEvent&	event, GCFPortInterface&	port) {
-	GCFTask::stop();
+	GCFScheduler::instance()->stop();
 	return (GCFEvent::HANDLED);
 }
 
@@ -143,13 +143,13 @@ int main(int	argc,	char*	argv[])
 		saName = argv[1];
 	}
 
-	GCFTask::init(argc, argv);
+	GCFScheduler::instance()->init(argc, argv);
 	LOG_INFO(formatString("Program %s has started", argv[0]));
 
 	CAL::calinfo		ciTask(saName);
 	ciTask.start();
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return (0);
 }
diff --git a/MAC/APL/PAC/CalServer/src/calinfo.h b/MAC/APL/PAC/CalServer/src/calinfo.h
index cda562f09b3d9e1e1724bc9fc1abeb5a95f8ff18..df98b39b91c7e991be48fb8b2bc6642ca3765ecc 100644
--- a/MAC/APL/PAC/CalServer/src/calinfo.h
+++ b/MAC/APL/PAC/CalServer/src/calinfo.h
@@ -34,6 +34,8 @@
 
 namespace LOFAR {
   using GCF::TM::GCFTask;
+  using GCF::TM::GCFPortInterface;
+  using GCF::TM::GCFTCPPort;
   namespace CAL {
 
 // \addtogroup CAL
diff --git a/MAC/APL/PAC/CalServer/test/CalTest.cc b/MAC/APL/PAC/CalServer/test/CalTest.cc
index 2799f5af36131f56c6300e9fff78027d5316e2b0..1de780b710fb5732f1c36b2d3d4aa71bdb003e1b 100644
--- a/MAC/APL/PAC/CalServer/test/CalTest.cc
+++ b/MAC/APL/PAC/CalServer/test/CalTest.cc
@@ -46,6 +46,7 @@ using namespace LOFAR;
 using namespace CAL;
 using namespace RTC;
 using namespace CAL_Protocol;
+using namespace GCF::TM;
 
 CalTest::CalTest(string name, string arrayname, string parentname, int nantennas, int nyquistzone, uint32 rcucontrol, int subarrayid)
   : GCFTask((State)&CalTest::initial, name), Test(name), m_handle(0), m_counter1(0),
@@ -272,7 +273,7 @@ GCFEvent::TResult CalTest::final(GCFEvent& e, GCFPortInterface& /*port*/)
   switch(e.signal)
   {
       case F_ENTRY:
-	  GCFTask::stop();
+	  GCFScheduler::instance()->stop();
 	  break;
       
       case F_EXIT:
@@ -289,12 +290,12 @@ GCFEvent::TResult CalTest::final(GCFEvent& e, GCFPortInterface& /*port*/)
 void CalTest::run()
 {
   start(); // make initial transition
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 }
 
 int main(int argc, char** argv)
 {
-  GCFTask::init(argc, argv);
+  GCFScheduler::instance()->init(argc, argv);
 
   if (argc != 8) {
     cerr << "usage: CalTest arrayname parentname nantennas nyquistzone rcucontrol subarray=[0|1|2]" << endl;
diff --git a/MAC/APL/PAC/CalServer/test/CalTest.h b/MAC/APL/PAC/CalServer/test/CalTest.h
index 0232d1516fc8f818c98210475f0f2861300bc98a..e64214a0ef909acb3d53b4e10d5a95d8a1cc7b6d 100644
--- a/MAC/APL/PAC/CalServer/test/CalTest.h
+++ b/MAC/APL/PAC/CalServer/test/CalTest.h
@@ -29,10 +29,11 @@
 #include <GCF/TM/GCF_Control.h>
 #include <Common/LofarTypes.h>
 
-namespace LOFAR
-{
-  namespace CAL
-    {
+namespace LOFAR {
+  using GCF::TM::GCFTask;
+  using GCF::TM::GCFPort;
+  using GCF::TM::GCFPortInterface;
+  namespace CAL {
 
       class CalTest : public GCFTask, public Test
 	{
diff --git a/MAC/APL/PIC/RSPDriver/src/Command.h b/MAC/APL/PIC/RSPDriver/src/Command.h
index e0e270c0f0ed125874bb8d40a87de502c4675dd5..b4ba4df5ada300660bc2c9624b1fffb5e7a31070 100644
--- a/MAC/APL/PIC/RSPDriver/src/Command.h
+++ b/MAC/APL/PIC/RSPDriver/src/Command.h
@@ -33,6 +33,7 @@
 #include <GCF/TM/GCF_Control.h>
 
 namespace LOFAR {
+  using GCF::TM::GCFPortInterface;
   namespace RSP {
 
 class Command : public RefCount
diff --git a/MAC/APL/PIC/RSPDriver/src/RSPDriver.cc b/MAC/APL/PIC/RSPDriver/src/RSPDriver.cc
index 8506944eed486d228f715a74efb6d06f342f68f0..6781f00b0842428a9539cc3684677d12c1167898 100644
--- a/MAC/APL/PIC/RSPDriver/src/RSPDriver.cc
+++ b/MAC/APL/PIC/RSPDriver/src/RSPDriver.cc
@@ -150,6 +150,7 @@
 #define PPS_FETCH_TIMEOUT { 3, 0 }
 
 namespace LOFAR {
+  using namespace GCF::TM;
   namespace RSP {
 	using namespace blitz;
 	using namespace std;
@@ -734,10 +735,12 @@ int RSPDriver::fetchPPS()
 //
 GCFEvent::TResult RSPDriver::initial(GCFEvent& event, GCFPortInterface& port)
 {
+	LOG_DEBUG_STR("RSPDriver::initial(" << eventName(event) << "@" << port.getName());
+
 	GCFEvent::TResult status = GCFEvent::HANDLED;
 
 	switch(event.signal) {
-	case F_INIT: {
+	case F_ENTRY: {
 		if (GET_CONFIG("RSPDriver.SYNC_MODE", i) == SYNC_PPS) {
 #ifdef HAVE_SYS_TIMEPPS_H
 			pps_params_t parm;
@@ -787,10 +790,10 @@ GCFEvent::TResult RSPDriver::initial(GCFEvent& event, GCFPortInterface& port)
 			exit(EXIT_FAILURE);
 #endif
 		} // sync mode
-	} // F_INIT
+	} // F_ENTRY
 	break;
 
-	case F_ENTRY: {
+	case F_INIT: {
 #if 0
 	if (GET_CONFIG("RSPDriver.SYNC_MODE", i) == SYNC_PARALLEL) {
 		if (!m_clock.isConnected()) m_clock.open();
@@ -2621,7 +2624,8 @@ using namespace LOFAR::RSP;
 
 int main(int argc, char** argv)
 {
-	GCFTask::init(argc, argv, "RSPDriver");    // initializes log system
+	GCFScheduler::instance()->init(argc, argv, "RSPDriver");    // initializes log system
+	GCFScheduler::instance()->disableQueue();					// run as fast as possible
 
 	// Inform Logprocessor who we are
 	LOG_INFO("MACProcessScope: LOFAR_PermSW_RSPDriver");
@@ -2688,7 +2692,7 @@ int main(int argc, char** argv)
 	rsp.start(); // make initial transition
 
 	try {
-		GCFTask::run();
+		GCFScheduler::instance()->run();
 	}
 	catch (Exception& e) {
 		LOG_ERROR_STR("Exception: " << e.text());
diff --git a/MAC/APL/PIC/RSPDriver/src/RSPDriver.h b/MAC/APL/PIC/RSPDriver/src/RSPDriver.h
index 979f42190d96ac5ab57ed3ff833e2c29f4ffb76c..ca5ad537c44ada42aa7ec376de1fb5a020c62c8c 100644
--- a/MAC/APL/PIC/RSPDriver/src/RSPDriver.h
+++ b/MAC/APL/PIC/RSPDriver/src/RSPDriver.h
@@ -41,6 +41,9 @@
 #endif
 
 namespace LOFAR {
+  using GCF::TM::GCFTask;
+  using GCF::TM::GCFTCPPort;
+  using GCF::TM::GCFETHRawPort;
   namespace RSP {
 
     class RSPDriver : public GCFTask
diff --git a/MAC/APL/PIC/RSPDriver/src/RawEvent.cc b/MAC/APL/PIC/RSPDriver/src/RawEvent.cc
index 7a1e7843bc8b1b86b21e18e33d95e332f9523ae1..13d00fc312491d2dd444b824f1cdc609ab8468dc 100644
--- a/MAC/APL/PIC/RSPDriver/src/RawEvent.cc
+++ b/MAC/APL/PIC/RSPDriver/src/RawEvent.cc
@@ -33,6 +33,7 @@
 #include "RawEvent.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace EPA_Protocol;
 
 /**
@@ -830,7 +831,7 @@ GCFEvent::TResult RawEvent::dispatch(GCFTask& task, GCFPortInterface& port)
 		//
 		// dispatch the MEP message as a GCFEvent (which it now is)
 		//
-		status = task.dispatch(buf.event, port);
+		status = task.doEvent(buf.event, port);
 	}
 	else {
 		LOG_WARN("F_DATAIN: Discarding unknown message.");
diff --git a/MAC/APL/PIC/RSPDriver/src/Scheduler.cc b/MAC/APL/PIC/RSPDriver/src/Scheduler.cc
index 5058fcfa83aa77862badedb8d443f3a6ad2554da..b370876e39bef6af5fcce4dde5af4b40cafb17a3 100644
--- a/MAC/APL/PIC/RSPDriver/src/Scheduler.cc
+++ b/MAC/APL/PIC/RSPDriver/src/Scheduler.cc
@@ -27,10 +27,11 @@
 #include "Scheduler.h"
 #include "SyncAction.h"
 
-using namespace LOFAR;
-using namespace RSP;
-using namespace RSP_Protocol;
-using namespace RTC;
+namespace LOFAR  {
+	using namespace GCF::TM;
+	using namespace RSP_Protocol;
+	using namespace RTC;
+	namespace RSP {
 
 #define SCHEDULING_DELAY 2
 
@@ -135,7 +136,7 @@ GCFEvent::TResult Scheduler::dispatch(GCFEvent& event, GCFPortInterface& port)
 		if (!(*sa)->hasCompleted()) {
 			// stil busy
 			sync_completed = false;
-			status = (*sa)->dispatch(*current_event, (*sa)->getBoardPort());
+			status = (*sa)->doEvent(*current_event, (*sa)->getBoardPort());
 
 			// When the SyncAction finished its work it set the completed-flag and went to the idle state.
 			// If the Syncaction was not finished is has sent a new msg to the board and we can wait for
@@ -435,7 +436,7 @@ void Scheduler::initiateSync(GCFEvent& event)
 		// dispatch F_TIMER event to first syncactions for each board
 		if (!(*port).second.empty()) {
 			for (unsigned int i = 0; i < (*port).second.size(); i++) {
-				(*port).second[i]->dispatch(event, (*port).second[i]->getBoardPort());
+				(*port).second[i]->doEvent(event, (*port).second[i]->getBoardPort());
 				if (!(*port).second[i]->doContinue()) {	// !doContinue() == msg was send, waiting for answer
 					break;
 				}
@@ -529,3 +530,5 @@ void Scheduler::completeCommands()
 	}
 }
 
+  } // namespace RSP
+} // namespace LOFAR
diff --git a/MAC/APL/PIC/RSPDriver/src/Sequencer.cc b/MAC/APL/PIC/RSPDriver/src/Sequencer.cc
index 614e78078b4d561fca266e4ee409e50df3aefc3c..1c3c705d9098a545027bebbc1b0433e92ac23120 100644
--- a/MAC/APL/PIC/RSPDriver/src/Sequencer.cc
+++ b/MAC/APL/PIC/RSPDriver/src/Sequencer.cc
@@ -30,11 +30,12 @@
 #include "Cache.h"
 #include "StationSettings.h"
 
-using namespace LOFAR;
-using namespace RSP;
-using namespace EPA_Protocol;
-using namespace RTC;
 using namespace blitz;
+namespace LOFAR {
+	using namespace GCF::TM;
+	using namespace EPA_Protocol;
+	using namespace RTC;
+	namespace RSP {
 
 #define TDREAD_TIMEOUT 3
 #define RSUCLEAR_WAIT  5
@@ -65,7 +66,7 @@ Sequencer::~Sequencer()
 
 void Sequencer::run(GCFEvent& event, GCFPortInterface& port)
 {
-  this->dispatch(event, port);
+  this->doEvent(event, port);
 }
 
 bool Sequencer::isActive() const
@@ -583,3 +584,7 @@ GCFEvent::TResult Sequencer::cdoenable_state(GCFEvent& event, GCFPortInterface&
 
   return GCFEvent::HANDLED;
 }
+
+  } // namespace RSP
+} // namespace LOFAR
+
diff --git a/MAC/APL/PIC/RSPDriver/src/Sequencer.h b/MAC/APL/PIC/RSPDriver/src/Sequencer.h
index 35e3d5963563c9d6e8b9d3b0ff8ea840c587a183..10577ba25a10ed9d5d6b72a7f52ae468fcd344ba 100644
--- a/MAC/APL/PIC/RSPDriver/src/Sequencer.h
+++ b/MAC/APL/PIC/RSPDriver/src/Sequencer.h
@@ -29,6 +29,9 @@
 #include <GCF/TM/GCF_Control.h>
 
 namespace LOFAR {
+  using GCF::TM::GCFFsm;
+  using GCF::TM::GCFPortInterface;
+  using GCF::TM::GCFTimerPort;
   namespace RSP {
 
     class Sequencer : public GCFFsm
diff --git a/MAC/APL/PIC/RSPDriver/src/SyncAction.cc b/MAC/APL/PIC/RSPDriver/src/SyncAction.cc
index 230b03f942aa386d454aa7ba6093216ab0b8d09b..de51f2a56bb51d7e8ae44649f69e23ff1f3e18dc 100644
--- a/MAC/APL/PIC/RSPDriver/src/SyncAction.cc
+++ b/MAC/APL/PIC/RSPDriver/src/SyncAction.cc
@@ -27,9 +27,10 @@
 #include "SyncAction.h"
 #include "Sequencer.h"
 
-using namespace LOFAR;
-using namespace RSP;
-using namespace EPA_Protocol;
+namespace LOFAR {
+  using namespace GCF::TM;
+  using namespace EPA_Protocol;
+  namespace RSP {
 
 #define N_RETRIES 10
 
@@ -238,3 +239,5 @@ void SyncAction::reset()
   TRAN(SyncAction::idle_state);
 }
 
+  } // namespace RSP
+} // namespace LOFAR
diff --git a/MAC/APL/PIC/RSPDriver/src/SyncAction.h b/MAC/APL/PIC/RSPDriver/src/SyncAction.h
index 0deb2d394f2103cab32b4944d6567ec37ddf61f1..66033b5ef58389e47fe4b8648a02a99fe569d25d 100644
--- a/MAC/APL/PIC/RSPDriver/src/SyncAction.h
+++ b/MAC/APL/PIC/RSPDriver/src/SyncAction.h
@@ -28,6 +28,8 @@
 #include <GCF/TM/GCF_Control.h>
 
 namespace LOFAR {
+  using GCF::TM::GCFFsm;
+  using GCF::TM::GCFPortInterface;
   namespace RSP {
 
     class SyncAction : public GCFFsm
diff --git a/MAC/APL/PIC/RSPDriver/src/rspctl.cc b/MAC/APL/PIC/RSPDriver/src/rspctl.cc
index 8a0437aada86865ce28c9e558386459b86cf9279..d02cb567e082a79be284e82e571484cee1deb35a 100644
--- a/MAC/APL/PIC/RSPDriver/src/rspctl.cc
+++ b/MAC/APL/PIC/RSPDriver/src/rspctl.cc
@@ -28,6 +28,7 @@
 #include <Common/hexdump.h>
 
 #include <MACIO/MACServiceInfo.h>
+#include <GCF/TM/GCF_Scheduler.h>
 
 #include <APL/RSP_Protocol/RSP_Protocol.ph>
 #include <APL/RSP_Protocol/EPA_Protocol.ph>
@@ -58,6 +59,7 @@
                 c-'A'+10 : ((c>='a' && c<='f') ? c-'a'+10 : 0)))
 
 namespace LOFAR {
+  using namespace GCF::TM;
   namespace rspctl {
 	using namespace std;
 	using namespace blitz;
@@ -229,7 +231,7 @@ GCFEvent::TResult WeightsCommand::ack(GCFEvent& e)
 			
       if (RSP_SUCCESS != ack.status) {
 				logMessage(cerr,"Error: RSP_GETWEIGHTS command failed.");
-				GCFTask::stop();
+				GCFScheduler::instance()->stop();
 				return status;
       }
 			
@@ -261,7 +263,7 @@ GCFEvent::TResult WeightsCommand::ack(GCFEvent& e)
 					}
 	      }
 	     
-	      GCFTask::stop();
+	      GCFScheduler::instance()->stop();
       	return status;
 	    } else {	
       	itsStage = 1;
@@ -276,13 +278,13 @@ GCFEvent::TResult WeightsCommand::ack(GCFEvent& e)
       if (RSP_SUCCESS != ack.status) {
         logMessage(cerr,"Error: RSP_SETWEIGHTS command failed.");
       }
-      GCFTask::stop();
+      GCFScheduler::instance()->stop();
       return status;
     } break;
 
     default:
       status = GCFEvent::NOT_HANDLED;
-      GCFTask::stop();
+      GCFScheduler::instance()->stop();
       return status;
       break;
   }
@@ -413,7 +415,7 @@ GCFEvent::TResult SubbandsCommand::ack(GCFEvent& e)
       break;
   }
 
-  GCFTask::stop();
+  GCFScheduler::instance()->stop();
 
   return status;
 }
@@ -488,7 +490,7 @@ GCFEvent::TResult RCUCommand::ack(GCFEvent& e)
 	break;
   } // switch
 
-  GCFTask::stop();
+  GCFScheduler::instance()->stop();
 
   return GCFEvent::HANDLED;
 }
@@ -620,7 +622,7 @@ GCFEvent::TResult HBACommand::ack(GCFEvent& e)
 	break;
 	}
 
-	GCFTask::stop();
+	GCFScheduler::instance()->stop();
 
 	return (GCFEvent::HANDLED);
 }
@@ -688,7 +690,7 @@ GCFEvent::TResult RSUCommand::ack(GCFEvent& e)
     }
   }
 
-  GCFTask::stop();
+  GCFScheduler::instance()->stop();
 
   return GCFEvent::HANDLED;
 }
@@ -748,7 +750,7 @@ GCFEvent::TResult ClockCommand::ack(GCFEvent& e)
     }
   }
 
-  GCFTask::stop();
+  GCFScheduler::instance()->stop();
 
   return GCFEvent::HANDLED;
 }
@@ -789,7 +791,7 @@ GCFEvent::TResult SubClockCommand::ack(GCFEvent& e)
 	if (g_getclock) {
 
 	  logMessage(cout,formatString("Sample frequency: clock=%dMHz", ack.clock));
-	  GCFTask::stop();
+	  GCFScheduler::instance()->stop();
 
 	} else {
 
@@ -906,7 +908,7 @@ GCFEvent::TResult TDStatusCommand::ack(GCFEvent& event)
 		}
 	}
 
-	GCFTask::stop();
+	GCFScheduler::instance()->stop();
 	return GCFEvent::HANDLED;
 }
 
@@ -1026,7 +1028,7 @@ GCFEvent::TResult TBBCommand::ack(GCFEvent& e)
 		break;
 	}
 
-	GCFTask::stop();
+	GCFScheduler::instance()->stop();
 
 	return status;
 }
@@ -1138,7 +1140,7 @@ GCFEvent::TResult SICommand::ack(GCFEvent& e)
 		break;
 	}
 
-	GCFTask::stop();
+	GCFScheduler::instance()->stop();
 
 	return status;
 }
@@ -1263,7 +1265,7 @@ GCFEvent::TResult SPUStatusCommand::ack(GCFEvent& event)
 		}
 	}
 
-	GCFTask::stop();
+	GCFScheduler::instance()->stop();
 	return (GCFEvent::HANDLED);
 }
 //
@@ -1340,7 +1342,7 @@ GCFEvent::TResult RawBlockCommand::ack(GCFEvent&	event)
 		cerr << "Unknown answer return while reading or writing a datablock" << endl;
 	}
 
-	GCFTask::stop();
+	GCFScheduler::instance()->stop();
 	return (GCFEvent::HANDLED);
 }
 
@@ -1447,7 +1449,7 @@ GCFEvent::TResult SplitterCommand::ack(GCFEvent& event)
 		break;
 	}
 
-	GCFTask::stop();
+	GCFScheduler::instance()->stop();
 	return (GCFEvent::HANDLED);
 }
 
@@ -1558,7 +1560,7 @@ GCFEvent::TResult WGCommand::ack(GCFEvent& e)
   }
   LOG_INFO("WGCommand success");
 
-  GCFTask::stop();
+  GCFScheduler::instance()->stop();
 
   return status;
 }
@@ -1723,7 +1725,7 @@ GCFEvent::TResult StatusCommand::ack(GCFEvent& event)
     break;
   }
 
-  GCFTask::stop();
+  GCFScheduler::instance()->stop();
   return GCFEvent::HANDLED;
 }
 
@@ -1769,7 +1771,7 @@ void StatisticsCommand::send()
   else {
     // SET
     logMessage(cerr,"Error: set mode not support for option '--statistics'");
-    GCFTask::stop();
+    GCFScheduler::instance()->stop();
   }
 }
 
@@ -1822,7 +1824,7 @@ void StatisticsCommand::capture_statistics(Array<double, 2>& stats, const Timest
       if(timeNow >= m_endTime) {
         logMessage(cout,"Statistics capturing successfully ended.");
         stop();
-        GCFTask::stop();
+        GCFScheduler::instance()->stop();
       }
     }
     
@@ -1998,7 +2000,7 @@ void XCStatisticsCommand::send()
   else {
     // SET
     logMessage(cerr,"Error: set mode not support for option '--xcstatistics'");
-    GCFTask::stop();
+    GCFScheduler::instance()->stop();
   }
 }
 
@@ -2051,7 +2053,7 @@ void XCStatisticsCommand::capture_xcstatistics(Array<complex<double>, 4>& stats,
 			if(timeNow >= m_endTime) {
 				logMessage(cout,"XCStatistics capturing successfully ended.");
 				stop();
-				GCFTask::stop();
+				GCFScheduler::instance()->stop();
 			}
 		}
 
@@ -2209,7 +2211,7 @@ GCFEvent::TResult VersionCommand::ack(GCFEvent& e)
   else {
     logMessage(cerr,"Error: RSP_GETVERSION command failed.");
   }
-  GCFTask::stop();
+  GCFScheduler::instance()->stop();
 
   return GCFEvent::HANDLED;
 }
@@ -2267,11 +2269,9 @@ GCFEvent::TResult RSPCtl::initial(GCFEvent& e, GCFPortInterface& port)
     break;
 
     case F_ENTRY: {
-      if (!m_server.isConnected())
-        if (!m_server.open()) {
-	  logMessage(cerr, "Error: failed to open port to RSPDriver");
-	  exit(EXIT_FAILURE);
-	}
+      if (!m_server.isConnected()) {
+        m_server.open();
+	  }
     }
     break;
 
@@ -2416,13 +2416,13 @@ GCFEvent::TResult RSPCtl::docommand(GCFEvent& e, GCFPortInterface& port)
 	case RSPFE_STOP_RSPCTL:
 		logMessage(cout,"Rspctl stopped by frontend.");
 		m_command->stop();
-		GCFTask::stop();
+		GCFScheduler::instance()->stop();
 	break;
 #endif
 
 	default:
 		logMessage(cerr,"Error: unhandled event.");
-		GCFTask::stop();
+		GCFScheduler::instance()->stop();
 		break;
 	}
 
@@ -2432,7 +2432,7 @@ GCFEvent::TResult RSPCtl::docommand(GCFEvent& e, GCFPortInterface& port)
 void RSPCtl::mainloop()
 {
   start(); // make initial transition
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 }
 
 static void usage(bool exportMode)
@@ -3441,7 +3441,7 @@ using namespace LOFAR::rspctl;
 
 int main(int argc, char** argv)
 {
-	GCFTask::init(argc, argv, "rspctl");
+	GCFScheduler::instance()->init(argc, argv, "rspctl");
 
 	LOG_INFO(formatString("Program %s has started", argv[0]));
 
diff --git a/MAC/APL/PIC/RSPDriver/src/rspctl.h b/MAC/APL/PIC/RSPDriver/src/rspctl.h
index 27b84cfa05515f82a1fe88783401d415bb312518..0730acc19ee6254016dbf23f465baf500dacd96f 100644
--- a/MAC/APL/PIC/RSPDriver/src/rspctl.h
+++ b/MAC/APL/PIC/RSPDriver/src/rspctl.h
@@ -36,7 +36,6 @@
 #include "RSPFE_Protocol.ph"
 #endif
 #include <GCF/TM/GCF_Control.h>
-#include <GCF/TM/GCF_ETHRawPort.h>
 
 #include <APL/RTCCommon/Timestamp.h>
 
@@ -44,6 +43,10 @@
 #include <blitz/array.h>
 
 namespace LOFAR {
+  using GCF::TM::GCFTask;
+  using GCF::TM::GCFPort;
+  using GCF::TM::GCFTCPPort;
+  using GCF::TM::GCFPortInterface;
   namespace rspctl {
 		
 //
diff --git a/MAC/APL/PIC/RSPDriver/test/EPAStub.cc b/MAC/APL/PIC/RSPDriver/test/EPAStub.cc
index 5d6144dd3e7c7ea1076482ebc3394585dac61a78..819c9e56841a7625a0f841c9aa3829760c6c02a9 100644
--- a/MAC/APL/PIC/RSPDriver/test/EPAStub.cc
+++ b/MAC/APL/PIC/RSPDriver/test/EPAStub.cc
@@ -23,16 +23,17 @@
 
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/ParameterSet.h>
+
+#include <GCF/TM/GCF_Scheduler.h>
 
 #include <APL/RSP_Protocol/EPA_Protocol.ph>
-#include "RawEvent.h"
+#include <APL/RSP_Protocol/BeamletWeights.h>
+#include <APL/RTCCommon/PSAccess.h>
 
+#include "RawEvent.h"
 #include "EPAStub.h"
 
-#include <APL/RSP_Protocol/BeamletWeights.h>
-
-#include <APL/RTCCommon/PSAccess.h>
-#include <Common/ParameterSet.h>
 
 #include <iostream>
 #include <sys/time.h>
@@ -40,8 +41,9 @@
 #include <math.h>
 
 using namespace std;
-using namespace LOFAR;
-using namespace RSP_Test;
+namespace LOFAR {
+  using namespace GCF::TM;
+  namespace RSP_Test {
 
 #define ETHERTYPE_EPA 0x10FA
 
@@ -547,7 +549,7 @@ GCFEvent::TResult EPAStub::final(GCFEvent& event, GCFPortInterface& /*port*/)
   switch(event.signal)
   {
     case F_ENTRY:
-      GCFTask::stop();
+      GCFScheduler::instance()->stop();
       break;
 
     case F_EXIT:
@@ -618,12 +620,21 @@ GCFEvent::TResult EPAStub::read_stats(EPAReadEvent& event, GCFPortInterface& por
 void EPAStub::run()
 {
   start(); // make initial transition
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 }
 
+
+  } // namespace RSP_Test
+} // namespace LOFAR
+
+
+using namespace LOFAR;
+using namespace RSP_Test;
+using namespace GCF::TM;
+
 int main(int argc, char** argv)
 {
-  GCFTask::init(argc, argv);
+  GCFScheduler::instance()->init(argc, argv);
 
   LOG_INFO(formatString("Program %s has started", argv[0]));
 
diff --git a/MAC/APL/PIC/RSPDriver/test/EPAStub.h b/MAC/APL/PIC/RSPDriver/test/EPAStub.h
index 1cbdf29f2cba8e4ed41166d4af443c52e22f1aeb..6d0737695901b2592fbec88858614f58c3d86166 100644
--- a/MAC/APL/PIC/RSPDriver/test/EPAStub.h
+++ b/MAC/APL/PIC/RSPDriver/test/EPAStub.h
@@ -27,9 +27,12 @@
 
 #include <Suite/test.h>
 #include <GCF/TM/GCF_Control.h>
-#include <GCF/TM/GCF_ETHRawPort.h>
 
 namespace LOFAR {
+  using GCF::TM::GCFTask;
+  using GCF::TM::GCFPortInterface;
+  using GCF::TM::GCFTimerPort;
+  using GCF::TM::GCFETHRawPort;
   namespace RSP_Test {
 
     class EPAStub : public GCFTask, public Test
diff --git a/MAC/APL/PIC/RSPDriver/test/RSPTest.cc b/MAC/APL/PIC/RSPDriver/test/RSPTest.cc
index 146f19831cac22bdb31e2f698056bee322a99789..9c9326e1448f90b08b9760ee76405c86ebfa3007 100644
--- a/MAC/APL/PIC/RSPDriver/test/RSPTest.cc
+++ b/MAC/APL/PIC/RSPDriver/test/RSPTest.cc
@@ -41,6 +41,7 @@
 using namespace std;
 using namespace blitz;
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace RTC;
 using namespace EPA_Protocol;
 using namespace RSP_Protocol;
@@ -1172,7 +1173,7 @@ GCFEvent::TResult RSPTest::final(GCFEvent& e, GCFPortInterface& /*port*/)
   switch(e.signal)
   {
       case F_ENTRY:
-	  GCFTask::stop();
+	  GCFScheduler::instance()->stop();
 	  break;
       
       case F_EXIT:
@@ -1189,12 +1190,12 @@ GCFEvent::TResult RSPTest::final(GCFEvent& e, GCFPortInterface& /*port*/)
 void RSPTest::run()
 {
   start(); // make initial transition
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 }
 
 int main(int argc, char** argv)
 {
-  GCFTask::init(argc, argv);
+  GCFScheduler::instance()->init(argc, argv);
 
   LOG_INFO(formatString("Program %s has started", argv[0]));
 
diff --git a/MAC/APL/PIC/RSPDriver/test/RSPTest.h b/MAC/APL/PIC/RSPDriver/test/RSPTest.h
index db8b78c47a8d5ad35fd854e111c624c7b5ebb7e0..cbe84ace1575354f600634a9d80474326561a431 100644
--- a/MAC/APL/PIC/RSPDriver/test/RSPTest.h
+++ b/MAC/APL/PIC/RSPDriver/test/RSPTest.h
@@ -33,6 +33,10 @@
 using LOFAR::MACIO::GCFEvent;
 
 namespace LOFAR {
+  using GCF::TM::GCFTask;
+  using GCF::TM::GCFPort;
+  using GCF::TM::GCFPortInterface;
+  using GCF::TM::GCFTimerPort;
   namespace RSP_Test {
   class RSPTest : public GCFTask, public Test
   {
diff --git a/MAC/APL/PIC/SHMInfoServer/src/SHMInfoServerMain.cc b/MAC/APL/PIC/SHMInfoServer/src/SHMInfoServerMain.cc
index 81fbd8b9ad7814c49e7153bfd89cf9a457210b37..ef4d2b7ea5b8bd1beb767bbdca07d9ab44cb52d2 100644
--- a/MAC/APL/PIC/SHMInfoServer/src/SHMInfoServerMain.cc
+++ b/MAC/APL/PIC/SHMInfoServer/src/SHMInfoServerMain.cc
@@ -31,7 +31,7 @@ using namespace LOFAR::AMI;
 
 int main(int argc, char *argv[])
 {
-	GCFTask::init(argc, argv, "SHMInfoServer");
+	GCFScheduler::instance()->init(argc, argv, "SHMInfoServer");
 	LOG_INFO("MACProcessScope: LOFAR_PermSW_SHMInfoServer");
 
 	SHMInfoServer 	sis;
@@ -39,7 +39,7 @@ int main(int argc, char *argv[])
 
 	//
 	try {
-	  GCFTask::run();
+	  GCFScheduler::instance()->run();
 	}
 	catch (std::exception& x) {
 	  LOG_INFO_STR("Unexpected exception: " << x.what());
diff --git a/MAC/APL/PIC/SHMInfoServer/src/SHMSession.cc b/MAC/APL/PIC/SHMInfoServer/src/SHMSession.cc
index 2bb3dadea36efc064d1dcb978c853e87c3a9eb97..b7226c1c76c77db4302e69e6f52758a4c6e604c5 100644
--- a/MAC/APL/PIC/SHMInfoServer/src/SHMSession.cc
+++ b/MAC/APL/PIC/SHMInfoServer/src/SHMSession.cc
@@ -207,12 +207,14 @@ GCFEvent::TResult SHMSession::waiting_state(GCFEvent& e, GCFPortInterface& p)
     
     case SHM_RECONFIGURATION_REQUEST:
       TRAN(SHMSession::reconfigure_state);
-      dispatch(e, p);
+//      dispatch(e, p);
+	  GCFScheduler::instance()->queueEvent(this, e, &p);
       break;
     
     case SHM_LOFAR_STRUCTURE_REQUEST:
       TRAN(SHMSession::getPICStructure_state);
-      dispatch(e, p);
+//      dispatch(e, p);
+	  GCFScheduler::instance()->queueEvent(this, e, &p);
       break;
     
 //    case SHM_PVSS_DP_SUBSCRIPTION_REQUEST:
diff --git a/MAC/APL/PIC/TBBDriver/src/AllocCmd.cc b/MAC/APL/PIC/TBBDriver/src/AllocCmd.cc
index 023ce5c211a0b23d2e4041de6e0897e950d01b5a..b99751c4c533aec40ace21855c973c3c71eb3575 100644
--- a/MAC/APL/PIC/TBBDriver/src/AllocCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/AllocCmd.cc
@@ -28,6 +28,7 @@
 #include "AllocCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/ArpCmd.cc b/MAC/APL/PIC/TBBDriver/src/ArpCmd.cc
index 12efc1ff5e192643d193e7d951230bac3157248a..3a6bd90ea9e421db9c4707f5af6bcccbd81446b4 100644
--- a/MAC/APL/PIC/TBBDriver/src/ArpCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/ArpCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;	
 using namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/ArpModeCmd.cc b/MAC/APL/PIC/TBBDriver/src/ArpModeCmd.cc
index 611ec2a8796cdf30342264bc56c3ff1bfcb393b6..a131b8a5a69fadc8d279ca588f78610ac007359a 100644
--- a/MAC/APL/PIC/TBBDriver/src/ArpModeCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/ArpModeCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;	
 using namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/BoardCmdHandler.cc b/MAC/APL/PIC/TBBDriver/src/BoardCmdHandler.cc
index 7987d1c10591f792fdab6a154840b613a58bd040..0ca9f5e63c031ad8dea7eb6185a2be4617938c92 100644
--- a/MAC/APL/PIC/TBBDriver/src/BoardCmdHandler.cc
+++ b/MAC/APL/PIC/TBBDriver/src/BoardCmdHandler.cc
@@ -33,6 +33,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using	namespace TBB;
 
diff --git a/MAC/APL/PIC/TBBDriver/src/BoardCmdHandler.h b/MAC/APL/PIC/TBBDriver/src/BoardCmdHandler.h
index 6b9f2556369e7a4869817fb84f73d2025ac54f63..ec1cb124f90e4231b88bbd5c7374a98be06b079f 100644
--- a/MAC/APL/PIC/TBBDriver/src/BoardCmdHandler.h
+++ b/MAC/APL/PIC/TBBDriver/src/BoardCmdHandler.h
@@ -45,6 +45,9 @@
 #include "DriverSettings.h"
 
 namespace LOFAR {
+	using GCF::TM::GCFFsm;
+	using GCF::TM::GCFPortInterface;
+	using GCF::TM::GCFTimerPort;
 	namespace TBB {
 	
 		class BoardCmdHandler : public GCFFsm
diff --git a/MAC/APL/PIC/TBBDriver/src/ClearCmd.cc b/MAC/APL/PIC/TBBDriver/src/ClearCmd.cc
index 32a3367c889e95ef03c8ce113acbfaa727085563..66de7cb44d8fdb1750259899efb97a2887f01dee 100644
--- a/MAC/APL/PIC/TBBDriver/src/ClearCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/ClearCmd.cc
@@ -28,6 +28,7 @@
 #include "ClearCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/ConfigCmd.cc b/MAC/APL/PIC/TBBDriver/src/ConfigCmd.cc
index a99fc4a48b42d9cb07f7b735b3b2b81016403fcc..babc8f7c5fa6d699799115b072e07d40c8bbb399 100644
--- a/MAC/APL/PIC/TBBDriver/src/ConfigCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/ConfigCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/DriverSettings.h b/MAC/APL/PIC/TBBDriver/src/DriverSettings.h
index cea2958643fba83a157e47a7c7ef596c5e5a7a0b..3885328d064d37db2ca70ad3e01355ed0b60ff11 100644
--- a/MAC/APL/PIC/TBBDriver/src/DriverSettings.h
+++ b/MAC/APL/PIC/TBBDriver/src/DriverSettings.h
@@ -31,6 +31,7 @@
 
 
 namespace LOFAR {
+  using GCF::TM::GCFPortInterface;
   namespace TBB {
 
 static const int DRIVER_VERSION = 206; // 2.06 
diff --git a/MAC/APL/PIC/TBBDriver/src/ErasefCmd.cc b/MAC/APL/PIC/TBBDriver/src/ErasefCmd.cc
index d7a8667147ab191b03f7782d0240a6a8909a5fbe..37798c4d5697a51bbf09db5a571104e280cb8c12 100644
--- a/MAC/APL/PIC/TBBDriver/src/ErasefCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/ErasefCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/FreeCmd.cc b/MAC/APL/PIC/TBBDriver/src/FreeCmd.cc
index 8671c53f26afbc59dca05cda125342df7390e9dd..b5a8d0b7a864bbc4515e06fbe79d2caa920eaf6e 100644
--- a/MAC/APL/PIC/TBBDriver/src/FreeCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/FreeCmd.cc
@@ -27,6 +27,7 @@
 #include "FreeCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/ImageInfoCmd.cc b/MAC/APL/PIC/TBBDriver/src/ImageInfoCmd.cc
index cd1c194f257c9d655aa49dc7e05486d29b97730d..379b79672bcae92ba1abfc8366be7ba92061ffb2 100644
--- a/MAC/APL/PIC/TBBDriver/src/ImageInfoCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/ImageInfoCmd.cc
@@ -26,6 +26,7 @@
 #include "ImageInfoCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/PageperiodCmd.cc b/MAC/APL/PIC/TBBDriver/src/PageperiodCmd.cc
index b412c0030497f76f9ffcb35cf0ee818df0648569..7f11111f9d060d992c4dc632a461d41d6629728b 100644
--- a/MAC/APL/PIC/TBBDriver/src/PageperiodCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/PageperiodCmd.cc
@@ -27,6 +27,7 @@
 #include "PageperiodCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/RawEvent.cc b/MAC/APL/PIC/TBBDriver/src/RawEvent.cc
index 8b605426341d41f3c51d65c80953beec52321d24..1b60c61c450253b1e1d599dc5b9426470bb38b42 100644
--- a/MAC/APL/PIC/TBBDriver/src/RawEvent.cc
+++ b/MAC/APL/PIC/TBBDriver/src/RawEvent.cc
@@ -226,7 +226,7 @@ GCFEvent::TResult RawEvent::dispatch(GCFTask& task, GCFPortInterface& port)
 		//
 		// dispatch the TP message as a GCFEvent (which it now is)
 		//
-		status = task.dispatch(buf.event, port);
+		status = task.doEvent(buf.event, port);
 	}
 	else
 	{
diff --git a/MAC/APL/PIC/TBBDriver/src/RawEvent.h b/MAC/APL/PIC/TBBDriver/src/RawEvent.h
index 130a99ceaf47c1945c162f59e9c8183495cd7a55..720ddbaf8a6b159faad764dad1798f8e37b5e50e 100644
--- a/MAC/APL/PIC/TBBDriver/src/RawEvent.h
+++ b/MAC/APL/PIC/TBBDriver/src/RawEvent.h
@@ -28,6 +28,8 @@
 #include <GCF/TM/GCF_Control.h>
 
 namespace LOFAR {
+	using GCF::TM::GCFTask;
+	using GCF::TM::GCFPortInterface;
 	namespace TBB {
 		
 		class RawEvent
diff --git a/MAC/APL/PIC/TBBDriver/src/ReadCmd.cc b/MAC/APL/PIC/TBBDriver/src/ReadCmd.cc
index f1fb2b950bafdafbd995f76155bc2a6f7dc9178d..d5c6a9039985d7c36b34535fc067a03d5ee6194a 100644
--- a/MAC/APL/PIC/TBBDriver/src/ReadCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/ReadCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/ReadfCmd.cc b/MAC/APL/PIC/TBBDriver/src/ReadfCmd.cc
index 8136892aa8f08879f6e2eac94192df9b9d8fdd31..2d2a014bedb1c1d3e6bacfde1ead5e084069d887 100644
--- a/MAC/APL/PIC/TBBDriver/src/ReadfCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/ReadfCmd.cc
@@ -27,6 +27,7 @@
 #include "ReadfCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/ReadrCmd.cc b/MAC/APL/PIC/TBBDriver/src/ReadrCmd.cc
index 097e4bfef053a1eee716c6029da719b706c79e4c..e8882551f2d3091403347273bf7cae05342a043f 100644
--- a/MAC/APL/PIC/TBBDriver/src/ReadrCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/ReadrCmd.cc
@@ -27,6 +27,7 @@
 #include "ReadrCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/ReadwCmd.cc b/MAC/APL/PIC/TBBDriver/src/ReadwCmd.cc
index 318818ce4f633c7268cc75c9b0b2f1b5e058edba..897c59a70414413fabb68f48d62ceec8eed265d7 100644
--- a/MAC/APL/PIC/TBBDriver/src/ReadwCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/ReadwCmd.cc
@@ -27,6 +27,7 @@
 #include "ReadwCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/ReadxCmd.cc b/MAC/APL/PIC/TBBDriver/src/ReadxCmd.cc
index e2e74da2ef97e50e9e95f699844fc8e44400b71e..9280872849ce5c435a22cbe320cafbfb3e29f8ba 100644
--- a/MAC/APL/PIC/TBBDriver/src/ReadxCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/ReadxCmd.cc
@@ -27,6 +27,7 @@
 #include "ReadxCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/RecordCmd.cc b/MAC/APL/PIC/TBBDriver/src/RecordCmd.cc
index 86c12088e67b3e6195329b403b054ad87965a7c5..a0f99bd896c6659a41a0737a3cbf87b4ce0b3adb 100644
--- a/MAC/APL/PIC/TBBDriver/src/RecordCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/RecordCmd.cc
@@ -27,6 +27,7 @@
 #include "RecordCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/ResetCmd.cc b/MAC/APL/PIC/TBBDriver/src/ResetCmd.cc
index 7c1cdc9549cdb697cddda8bc33b3e0ef7c8e4bf5..cb930f5a9c64fd862419a5c6200b1e0115005585 100644
--- a/MAC/APL/PIC/TBBDriver/src/ResetCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/ResetCmd.cc
@@ -28,6 +28,7 @@
 #include "ResetCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/SizeCmd.cc b/MAC/APL/PIC/TBBDriver/src/SizeCmd.cc
index 914fb4ff2e0d28554080e160928c563e457365ee..3b2e8c11c074f21d6fb8decc96bc29737cb4e9ab 100644
--- a/MAC/APL/PIC/TBBDriver/src/SizeCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/SizeCmd.cc
@@ -27,6 +27,7 @@
 #include "SizeCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/StatusCmd.cc b/MAC/APL/PIC/TBBDriver/src/StatusCmd.cc
index 13ae1b4c93c84cfab67d185f99e1c309165c95a6..6675b425a8092fad513e88fffddf03564b0c738b 100644
--- a/MAC/APL/PIC/TBBDriver/src/StatusCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/StatusCmd.cc
@@ -26,6 +26,7 @@
 #include "StatusCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/StopCepCmd.cc b/MAC/APL/PIC/TBBDriver/src/StopCepCmd.cc
index 644d29054af6a35731b4a65700c7c7d2e38639db..c8d79f7d569e3ea26d290b0478617ade9023b007 100644
--- a/MAC/APL/PIC/TBBDriver/src/StopCepCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/StopCepCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;	
 using namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/StopCmd.cc b/MAC/APL/PIC/TBBDriver/src/StopCmd.cc
index 44e4b8f1daaa3295223fe427e1034f0179cb65a3..49ebe046422287a0d9a38fd8dd8ba76023e8c224 100644
--- a/MAC/APL/PIC/TBBDriver/src/StopCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/StopCmd.cc
@@ -27,6 +27,7 @@
 #include "StopCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/TBBDriver.cc b/MAC/APL/PIC/TBBDriver/src/TBBDriver.cc
index 2c55ba039966e6f72db97ad7f57ef697bdaaf1f4..b0395ca0e19b5dba49947a347d54dcd988d7938c 100644
--- a/MAC/APL/PIC/TBBDriver/src/TBBDriver.cc
+++ b/MAC/APL/PIC/TBBDriver/src/TBBDriver.cc
@@ -74,6 +74,7 @@
 #define ETHERTYPE_TP 0x7BB0     // letters of TBB
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB;
 
 static bool   itsDaemonize  = false;
@@ -590,7 +591,7 @@ GCFEvent::TResult TBBDriver::idle_state(GCFEvent& event, GCFPortInterface& port)
 				LOG_DEBUG_STR("queue:" << eventName(*e));
 				
 				if (SetTbbCommand(e->signal)) {
-					status = cmdhandler->dispatch(*e,*itsTbbQueue->front()->port);
+					status = cmdhandler->doEvent(*e,*itsTbbQueue->front()->port);
 					// delete e;
 
 					TbbEvent* tmp = itsTbbQueue->front();
@@ -709,7 +710,7 @@ GCFEvent::TResult TBBDriver::idle_state(GCFEvent& event, GCFPortInterface& port)
 					itsAliveTimer->cancelAllTimers();
 					itsAliveTimer->setTimer(ALIVECHECKTIME);
 					itsAliveCheck = false;
-					status = cmdhandler->dispatch(event,port);
+					status = cmdhandler->doEvent(event,port);
 					TRAN(TBBDriver::busy_state);
 				} else {
 					TBBDriverBusyAckEvent ack;    
@@ -788,7 +789,7 @@ GCFEvent::TResult TBBDriver::busy_state(GCFEvent& event, GCFPortInterface& port)
 					itsAliveTimer->setTimer(ALIVECHECKTIME);
 				}
 			} else {
-				status = cmdhandler->dispatch(event,port); // dispatch time-out event 
+				status = cmdhandler->doEvent(event,port); // dispatch time-out event 
 			}
 		} break;
 		
@@ -865,7 +866,7 @@ GCFEvent::TResult TBBDriver::busy_state(GCFEvent& event, GCFPortInterface& port)
 		case TP_WATCHDOG_ACK:
 		case TP_TEMP_LIMIT_ACK: 
 		{
-			status = cmdhandler->dispatch(event,port); // dispatch ack from boards  
+			status = cmdhandler->doEvent(event,port); // dispatch ack from boards  
 			if (cmdhandler->tpCmdDone()) {
 				TRAN(TBBDriver::idle_state);
 			}
@@ -1358,7 +1359,7 @@ bool TBBDriver::SetTbbCommand(unsigned short signal)
 //
 int main(int argc, char** argv)
 {
-	LOFAR::GCF::TM::GCFTask::init(argc, argv, "TBBDriver");    // initializes log system
+	LOFAR::GCF::TM::GCFScheduler::instance()->init(argc, argv, "TBBDriver");    // initializes log system
 	
 	// Inform Logprocessor who we are
 	LOG_INFO("MACProcessScope: LOFAR_PermSW_TBBDriver");
@@ -1394,7 +1395,7 @@ int main(int argc, char** argv)
 	tbb.start(); // make initialsition
 	
 	try {
-		LOFAR::GCF::TM::GCFTask::run();
+		LOFAR::GCF::TM::GCFScheduler::instance()->run();
 	}
 	catch (LOFAR::Exception& e) {
 		LOG_ERROR_STR("Exception: " << e.text());
diff --git a/MAC/APL/PIC/TBBDriver/src/TBBDriver.h b/MAC/APL/PIC/TBBDriver/src/TBBDriver.h
index ede0d95ba6995efe11821f14613552b6e4fe4a7b..604ef44007eb9d472e07693cc0076cf11e56e730 100644
--- a/MAC/APL/PIC/TBBDriver/src/TBBDriver.h
+++ b/MAC/APL/PIC/TBBDriver/src/TBBDriver.h
@@ -40,6 +40,11 @@
 //# Never #include <config.h> or #include <lofar_config.h> in a header file!
 
 namespace LOFAR{
+  using GCF::TM::GCFTask;
+  using GCF::TM::GCFTCPPort;
+  using GCF::TM::GCFETHRawPort;
+  using GCF::TM::GCFPortInterface;
+  using GCF::TM::GCFTimerPort;
   namespace TBB{
 
     // Description of class.
diff --git a/MAC/APL/PIC/TBBDriver/src/TempLimitCmd.cc b/MAC/APL/PIC/TBBDriver/src/TempLimitCmd.cc
index 607033bce7ea141ff5796a4da4c87460f05594d4..85c55980c8576e03a7e42a23ad352b2cf19f68ea 100644
--- a/MAC/APL/PIC/TBBDriver/src/TempLimitCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/TempLimitCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;	
 using namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/TrigCoefCmd.cc b/MAC/APL/PIC/TBBDriver/src/TrigCoefCmd.cc
index a8a3457b83cdc605a0278fb45a50617ade3eb1fc..f5b3a00e5b941da1ea7907f0c7346a0582fbf267 100644
--- a/MAC/APL/PIC/TBBDriver/src/TrigCoefCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/TrigCoefCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/TrigGenCmd.cc b/MAC/APL/PIC/TBBDriver/src/TrigGenCmd.cc
index da0599c9e459b81e47e33d4a006c3ce3516bcfa2..3494b901558ac2c196298300a1f7b05923affd9b 100644
--- a/MAC/APL/PIC/TBBDriver/src/TrigGenCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/TrigGenCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/TrigInfoCmd.cc b/MAC/APL/PIC/TBBDriver/src/TrigInfoCmd.cc
index dd90291dbee3826ee20d417c2e7d42b648561e5d..eb7f952da046fd25039fc56c48f58af00e6a4545 100644
--- a/MAC/APL/PIC/TBBDriver/src/TrigInfoCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/TrigInfoCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/TrigReleaseCmd.cc b/MAC/APL/PIC/TBBDriver/src/TrigReleaseCmd.cc
index e7dc415b3c0c8c6981f903cfa87d84b57070a2dc..da9bbe9c01e0775b6ddc7cb7a7d0214d2c5a3fdc 100644
--- a/MAC/APL/PIC/TBBDriver/src/TrigReleaseCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/TrigReleaseCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/TrigSetupCmd.cc b/MAC/APL/PIC/TBBDriver/src/TrigSetupCmd.cc
index f479fc6603082f14fc4457b0fccc10285f92503e..6e81aca9d2a2863138d827984e36e168c986b508 100644
--- a/MAC/APL/PIC/TBBDriver/src/TrigSetupCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/TrigSetupCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/TrigclrCmd.cc b/MAC/APL/PIC/TBBDriver/src/TrigclrCmd.cc
index e1de9037421e74abaf29655db9128bf04800d963..601dc93750bd76a4d2c853872830ffef484a9850 100644
--- a/MAC/APL/PIC/TBBDriver/src/TrigclrCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/TrigclrCmd.cc
@@ -27,6 +27,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/UdpCmd.cc b/MAC/APL/PIC/TBBDriver/src/UdpCmd.cc
index 540a8b5eb455b67b9e206bd13e970828076346f6..0225c6946def3e695266e09e17c959971434d740 100644
--- a/MAC/APL/PIC/TBBDriver/src/UdpCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/UdpCmd.cc
@@ -29,6 +29,7 @@
 #include "UdpCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/VersionCmd.cc b/MAC/APL/PIC/TBBDriver/src/VersionCmd.cc
index 42ea530000ac2f70839fd6849821d07d6e4d6436..431d6a90614cac352a9a06bf0c7c11fe9dd60400 100644
--- a/MAC/APL/PIC/TBBDriver/src/VersionCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/VersionCmd.cc
@@ -28,6 +28,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;	
 using namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/WatchDogCmd.cc b/MAC/APL/PIC/TBBDriver/src/WatchDogCmd.cc
index f62fa5ec435eec40f755310b72aae4f7265ba6ae..0fdb5fc2c0f367aae9089d0b73acb8a9327bcc38 100644
--- a/MAC/APL/PIC/TBBDriver/src/WatchDogCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/WatchDogCmd.cc
@@ -28,6 +28,7 @@
 #include "WatchDogCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/WritefCmd.cc b/MAC/APL/PIC/TBBDriver/src/WritefCmd.cc
index d6f512d4d44794f093d96329bb9f32f43d662d77..d7afc5d8ec85675bef9939199df423ee05dde1db 100644
--- a/MAC/APL/PIC/TBBDriver/src/WritefCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/WritefCmd.cc
@@ -29,6 +29,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/WriterCmd.cc b/MAC/APL/PIC/TBBDriver/src/WriterCmd.cc
index c7905a5cf1b9a2b8415669a4d393157178ff3e19..bc5fa1010f9ab793d0c9a7d6c0d848f4687fa46a 100644
--- a/MAC/APL/PIC/TBBDriver/src/WriterCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/WriterCmd.cc
@@ -27,6 +27,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/WritewCmd.cc b/MAC/APL/PIC/TBBDriver/src/WritewCmd.cc
index 3532b478114cdce468a284be870bde71d651fe21..cf23c07d63adad3be2bf0af2a0325507ea3dfd92 100644
--- a/MAC/APL/PIC/TBBDriver/src/WritewCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/WritewCmd.cc
@@ -27,6 +27,7 @@
 #include "WritewCmd.h"
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;
 using	namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/XXXCmd.cc b/MAC/APL/PIC/TBBDriver/src/XXXCmd.cc
index ed3bb055ad0ad9d94f83be89f2f26e3a2db6c9a4..06ab3c8ed34b856961a6076e2fc46ab047303168 100644
--- a/MAC/APL/PIC/TBBDriver/src/XXXCmd.cc
+++ b/MAC/APL/PIC/TBBDriver/src/XXXCmd.cc
@@ -27,6 +27,7 @@
 
 
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TP_Protocol;	
 using namespace TBB;
diff --git a/MAC/APL/PIC/TBBDriver/src/tbbctl.cc b/MAC/APL/PIC/TBBDriver/src/tbbctl.cc
index 0e8bc8f9e05403aab5cbc111379d10b9b1b6a9d9..a9a7a9483be11cc1f67f96631f4b5061a8f52643 100644
--- a/MAC/APL/PIC/TBBDriver/src/tbbctl.cc
+++ b/MAC/APL/PIC/TBBDriver/src/tbbctl.cc
@@ -53,6 +53,7 @@
 using namespace std;
 //using namespace blitz;
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TBB_Protocol;
 using namespace TbbCtl;
 
@@ -2509,7 +2510,7 @@ GCFEvent::TResult TBBCtl::initial(GCFEvent& e, GCFPortInterface& port)
 
 		case TBB_DRIVER_BUSY_ACK: {
 		cout << endl << "=x=x=   DRIVER BUSY, with setting up boards, try again   =x=x=" << endl << flush;
-		GCFTask::stop();    
+		GCFScheduler::instance()->stop();    
 	 }
 
 	 case TBB_GET_CONFIG_ACK: {
@@ -2519,7 +2520,7 @@ GCFEvent::TResult TBBCtl::initial(GCFEvent& e, GCFPortInterface& port)
 		itsMaxChannels = itsMaxBoards * 16;
 		if (itsActiveBoards == 0) {
 		  cout << "=x=x=   NO boards available   =x=x=" << endl << flush;
-		  GCFTask::stop();    
+		  GCFScheduler::instance()->stop();    
 		}      
 			
 		// send subscribe 
@@ -2592,7 +2593,7 @@ GCFEvent::TResult TBBCtl::docommand(GCFEvent& e, GCFPortInterface& port)
 				cout << endl;
 				TBBUnsubscribeEvent unsubscribe;
 				itsServerPort.send(unsubscribe);
-				GCFTask::stop();
+				GCFScheduler::instance()->stop();
 			}
 		} break;
 	
@@ -2601,7 +2602,7 @@ GCFEvent::TResult TBBCtl::docommand(GCFEvent& e, GCFPortInterface& port)
 	
 		case TBB_DRIVER_BUSY_ACK: {
 			cout << "DRIVER BUSY, try again" << endl << flush;
-			GCFTask::stop();    
+			GCFScheduler::instance()->stop();    
 		}
 			
 		case TBB_ALLOC_ACK:
@@ -2652,7 +2653,7 @@ GCFEvent::TResult TBBCtl::docommand(GCFEvent& e, GCFPortInterface& port)
 			cout << formatString("Error: unhandled event. %d",e.signal) << endl;
 			//TBBUnsubscribeEvent unsubscribe;
 			//itsServerPort.send(unsubscribe);
-			GCFTask::stop();
+			GCFScheduler::instance()->stop();
 		} break;
 	}
 	
@@ -2660,7 +2661,7 @@ GCFEvent::TResult TBBCtl::docommand(GCFEvent& e, GCFPortInterface& port)
 		//TBBUnsubscribeEvent unsubscribe;
 		//itsServerPort.send(unsubscribe);
 		cout << flush;
-		GCFTask::stop();
+		GCFScheduler::instance()->stop();
 	}
 		 
 	return(status);
@@ -3290,7 +3291,7 @@ Command* TBBCtl::parse_options(int argc, char** argv)
 					uint32 word[8];
 					
 					int numitems = sscanf(optarg, "%d,%d,%x,%x,%x,%x,%x,%x,%x,%x,%x", &board,&mp,&addr,
-										 &word[0],&word[1],&word[2],&word[3],&word[4],&word[5],&word[6],&word[7]);
+										 &word[1],&word[2],&word[3],&word[4],&word[5],&word[6],&word[7]);
 					if (numitems < 5 || numitems == EOF || board < 0 || board >= itsMaxBoards || mp > 3) {
 						cout << "Error: invalid write ddr value. Should be of the format " << endl;
 						cout <<  "       '--writew=board, mp, addr, word[0], word[1] .. word[7]'"<< endl; 
@@ -3510,7 +3511,7 @@ std::list<int> TBBCtl::strtolist(const char* str, int max)
 void TBBCtl::mainloop()
 {
   start(); // make initial transition
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 	
 	TBBUnsubscribeEvent unsubscribe;
 	itsServerPort.send(unsubscribe);
@@ -3519,7 +3520,7 @@ void TBBCtl::mainloop()
 //-----------------------------------------------------------------------------
 int main(int argc, char** argv)
 {
-  GCFTask::init(argc, argv, "tbbctl");
+  GCFScheduler::instance()->init(argc, argv, "tbbctl");
   
   LOG_DEBUG(formatString("Program %s has started", argv[0]));
 
diff --git a/MAC/APL/PIC/TBBDriver/src/tbbctl.h b/MAC/APL/PIC/TBBDriver/src/tbbctl.h
index 19de286e9f795a982630fce6bc76eed26978cafc..50b2072c42305903ed50523e2f7c715f982dca45 100644
--- a/MAC/APL/PIC/TBBDriver/src/tbbctl.h
+++ b/MAC/APL/PIC/TBBDriver/src/tbbctl.h
@@ -36,6 +36,10 @@
 
 
 namespace LOFAR {
+  using GCF::TM::GCFTask;
+  using GCF::TM::GCFPort;
+  using GCF::TM::GCFTimerPort;
+  using GCF::TM::GCFPortInterface;
   namespace TbbCtl {
   	
 // MAX_N_TBBOARDS and MAX_N_RCUS come from TBB_protocol.ph
diff --git a/MAC/APL/PIC/TBBDriver/test/StubRawEvent.cc b/MAC/APL/PIC/TBBDriver/test/StubRawEvent.cc
index 885bf9a4c9792b5c2b94b37ae799addff7596895..a590589da0f54f364afb20f9f29422e77514b9a8 100644
--- a/MAC/APL/PIC/TBBDriver/test/StubRawEvent.cc
+++ b/MAC/APL/PIC/TBBDriver/test/StubRawEvent.cc
@@ -189,7 +189,7 @@ GCFEvent::TResult RawEvent::dispatch(GCFTask& task, GCFPortInterface& port)
 		//
 		// dispatch the TP message as a GCFEvent (which it now is)
 		//
-		status = task.dispatch(buf.event, port);
+		status = task.doEvent(buf.event, port);
 	}
   else
 	{
diff --git a/MAC/APL/PIC/TBBDriver/test/TBBTest.cc b/MAC/APL/PIC/TBBDriver/test/TBBTest.cc
index 48566b6f5d680b1c776c726202957755d4dad116..3fffecc12cf869f348494d01f7b3b0097bf9fa51 100644
--- a/MAC/APL/PIC/TBBDriver/test/TBBTest.cc
+++ b/MAC/APL/PIC/TBBDriver/test/TBBTest.cc
@@ -38,6 +38,7 @@
 
 using namespace std;
 using namespace LOFAR;
+using namespace GCF::TM;
 //using namespace RTC;
 using namespace TBB_Protocol;
 using namespace TBB_Test;
@@ -660,7 +661,7 @@ GCFEvent::TResult TBBTest::final(GCFEvent& e, GCFPortInterface& /*port*/)
   switch(e.signal)
   {
       case F_ENTRY:
-	  GCFTask::stop();
+	  GCFScheduler::instance()->stop();
 	  break;
       
       case F_EXIT:
@@ -677,13 +678,13 @@ GCFEvent::TResult TBBTest::final(GCFEvent& e, GCFPortInterface& /*port*/)
 void TBBTest::run()
 {
   start(); // make initial transition
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 }
 
 
 int main(int argc, char** argv)
 {
-  GCFTask::init(argc, argv);
+  GCFScheduler::instance()->init(argc, argv);
 
   LOG_INFO(formatString("Program %s has started", argv[0]));
 
diff --git a/MAC/APL/PIC/TBBDriver/test/TBBTest.h b/MAC/APL/PIC/TBBDriver/test/TBBTest.h
index 8c4c8ad3dd150ccc231c728715564451cf2c7e51..f5ce1730499faf7422e5378b3f9215454de2c500 100644
--- a/MAC/APL/PIC/TBBDriver/test/TBBTest.h
+++ b/MAC/APL/PIC/TBBDriver/test/TBBTest.h
@@ -30,6 +30,10 @@
 #include <GCF/TM/GCF_ETHRawPort.h>
 
 namespace LOFAR {
+	using GCF::TM::GCFTask;
+	using GCF::TM::GCFPort;
+	using GCF::TM::GCFETHRawPort;
+	using GCF::TM::GCFPortInterface;
 	namespace TBB_Test {
   
   class TBBTest : public GCFTask, public Test
diff --git a/MAC/APL/PIC/TBBDriver/test/TPStub.cc b/MAC/APL/PIC/TBBDriver/test/TPStub.cc
index 4c8ef90bd80315ec1dec724d7960fe047afd2168..9055c3c00bcffb04e281e44915cb51b750daf808 100644
--- a/MAC/APL/PIC/TBBDriver/test/TPStub.cc
+++ b/MAC/APL/PIC/TBBDriver/test/TPStub.cc
@@ -38,6 +38,7 @@
 
 using namespace std;
 using namespace LOFAR;
+using namespace GCF::TM;
 using namespace TP_Protocol;
 using namespace TBB;
 using namespace TBB_Test;
@@ -318,7 +319,7 @@ GCFEvent::TResult TPStub::final(GCFEvent &event, GCFPortInterface& /*port*/)
   {
     case F_ENTRY:
 			{
-				GCFTask::stop();
+				GCFScheduler::instance()->stop();
     	} break;
 
     case F_EXIT:
@@ -335,12 +336,12 @@ GCFEvent::TResult TPStub::final(GCFEvent &event, GCFPortInterface& /*port*/)
 void TPStub::run()
 {
   start(); // make initial transition
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 }
 
 int main(int argc, char** argv)
 {
-  GCFTask::init(argc, argv);
+  GCFScheduler::instance()->init(argc, argv);
 	
 	LOG_DEBUG_STR("Reading configuration files");
   try {
diff --git a/MAC/APL/PIC/TBBDriver/test/TPStub.h b/MAC/APL/PIC/TBBDriver/test/TPStub.h
index 84bba37a8940165b3de79c2638bdefb44ce6dd50..feee1527484794eef285c54bd8bd8c5d98ea2aa1 100644
--- a/MAC/APL/PIC/TBBDriver/test/TPStub.h
+++ b/MAC/APL/PIC/TBBDriver/test/TPStub.h
@@ -32,6 +32,9 @@
 #include "TP_Protocol.ph"
 
 namespace LOFAR {
+	using GCF::TM::GCFTask;
+	using GCF::TM::GCFETHRawPort;
+	using GCF::TM::GCFPortInterface;
 	namespace TBB_Test {
 
     class TPStub : public GCFTask, public Test
diff --git a/MAC/APL/RTDBCommon/include/APL/RTDBCommon/ClaimMgrTask.h b/MAC/APL/RTDBCommon/include/APL/RTDBCommon/ClaimMgrTask.h
index 3fc8c378e855f0deef79baf6f63c5f560354e37c..63d518c2ee92f0d16f6d8643a4ad0cd6d9065dbe 100644
--- a/MAC/APL/RTDBCommon/include/APL/RTDBCommon/ClaimMgrTask.h
+++ b/MAC/APL/RTDBCommon/include/APL/RTDBCommon/ClaimMgrTask.h
@@ -33,6 +33,7 @@
 namespace LOFAR {
   using GCF::TM::GCFTask;
   using GCF::TM::GCFTCPPort;
+  using GCF::TM::GCFTimerPort;
   using GCF::TM::GCFPortInterface;
   using GCF::TM::GCFHandler;
   using GCF::RTDB::RTDBPropertySet;
diff --git a/MAC/APL/RTDBCommon/test/tClaimManager.cc b/MAC/APL/RTDBCommon/test/tClaimManager.cc
index 6fd330d35256f6dab47a7e5e4a957d4330c810e1..b4dde90639d814fbff4df0ab15f85d3d185052c2 100644
--- a/MAC/APL/RTDBCommon/test/tClaimManager.cc
+++ b/MAC/APL/RTDBCommon/test/tClaimManager.cc
@@ -89,7 +89,7 @@ GCFEvent::TResult MgrTest::doTest(GCFEvent& event, GCFPortInterface& port)
 	break;
 
 	case F_TIMER:
-		stop();
+		GCFScheduler::instance()->stop();
 		break;
 
 	default:
@@ -111,12 +111,12 @@ using namespace LOFAR::APL::RTDBCommon;
 
 int main(int argc, char* argv[])
 {
-	TM::GCFTask::init(argc, argv);
+	TM::GCFScheduler::instance()->init(argc, argv);
 
 	MgrTest test_task("UtilTest");  
 	test_task.start(); // make initial transition
 
-	TM::GCFTask::run();
+	TM::GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/APL/RTDBCommon/test/tClaimManager.h b/MAC/APL/RTDBCommon/test/tClaimManager.h
index 7d011b55dddad0849549df3b7f440acfc170b6a0..224a6bdc401e5a99c8efa0c3c8a3cefd0fd4085c 100644
--- a/MAC/APL/RTDBCommon/test/tClaimManager.h
+++ b/MAC/APL/RTDBCommon/test/tClaimManager.h
@@ -30,7 +30,7 @@ namespace LOFAR {
  namespace APL {
   namespace RTDBCommon {
 
-class MgrTest : public GCFTask
+class MgrTest : public GCF::TM::GCFTask
 {
 public:
 	MgrTest (const string& name);
@@ -39,9 +39,9 @@ public:
 	GCFEvent::TResult doTest	(GCFEvent& e, GCFPortInterface& p);
 
 private:
-	GCFTimerPort*		itsTimerPort;
-	GCFITCPort*			itsMsgPort;
-	ClaimMgrTask*		itsClaimMgrTask;
+	GCF::TM::GCFTimerPort*		itsTimerPort;
+	GCF::TM::GCFITCPort*		itsMsgPort;
+	ClaimMgrTask*				itsClaimMgrTask;
 };
 
   } // namespace RTDBCommon
diff --git a/MAC/APL/RTDBCommon/test/tRTDButilities.cc b/MAC/APL/RTDBCommon/test/tRTDButilities.cc
index b0f26fdffc68b84f57c4aa6ad8d2c4aca1d6b96f..c99ef65742bc5cbdf5faf22f336f2da18cbc7460 100644
--- a/MAC/APL/RTDBCommon/test/tRTDButilities.cc
+++ b/MAC/APL/RTDBCommon/test/tRTDButilities.cc
@@ -88,7 +88,7 @@ GCFEvent::TResult tRTDButil::doTest(GCFEvent& e, GCFPortInterface& /*p*/)
 			itsTimerPort->setTimer(3.0);
 		}
 		else {
-			stop();
+			GCFScheduler::instance()->stop();
 		}
 	break;
 
@@ -111,12 +111,12 @@ using namespace LOFAR::APL::RTDBCommon;
 
 int main(int argc, char* argv[])
 {
-	TM::GCFTask::init(argc, argv);
+	TM::GCFScheduler::instance()->init(argc, argv);
 
 	tRTDButil test_task("UtilTest");  
 	test_task.start(); // make initial transition
 
-	TM::GCFTask::run();
+	TM::GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/APL/RTDBCommon/test/tRTDButilities.h b/MAC/APL/RTDBCommon/test/tRTDButilities.h
index 86fb34ff8564aa9b534ed31c864111aaec20db1b..e25d16b34db2fd3947ee07155e909b524d4d2437 100644
--- a/MAC/APL/RTDBCommon/test/tRTDButilities.h
+++ b/MAC/APL/RTDBCommon/test/tRTDButilities.h
@@ -30,16 +30,16 @@ namespace LOFAR {
  namespace APL {
   namespace RTDBCommon {
 
-class tRTDButil : public GCFTask
+class tRTDButil : public GCF::TM::GCFTask
 {
 public:
 	tRTDButil (const string& name);
 	virtual ~tRTDButil();
 
-	GCFEvent::TResult doTest	(GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult doTest	(GCFEvent& e, GCF::TM::GCFPortInterface& p);
 
 private:
-	GCFTimerPort*		itsTimerPort;
+	GCF::TM::GCFTimerPort*		itsTimerPort;
 };
 
   } // namespace RTDBCommon
diff --git a/MAC/APL/StationCU/include/APL/ClockProtocol/Makefile.am b/MAC/APL/StationCU/include/APL/ClockProtocol/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..8534475bf7b5763ba646956760f532bcd381610c
--- /dev/null
+++ b/MAC/APL/StationCU/include/APL/ClockProtocol/Makefile.am
@@ -0,0 +1,3 @@
+
+include $(top_srcdir)/Makefile.common
+
diff --git a/MAC/APL/StationCU/include/APL/ClockProtocol/Package__Version.h b/MAC/APL/StationCU/include/APL/ClockProtocol/Package__Version.h
new file mode 100644
index 0000000000000000000000000000000000000000..88fd33c8a19ee3288274e7908342a67da274e514
--- /dev/null
+++ b/MAC/APL/StationCU/include/APL/ClockProtocol/Package__Version.h
@@ -0,0 +1,40 @@
+//# Get revision info; generated by autoconf_share/makeversion
+
+#ifndef LOFAR_STATIONCU_PACKAGE__VERSION_H
+#define LOFAR_STATIONCU_PACKAGE__VERSION_H
+
+#include <Common/Version.h>
+
+// Class to get the version (revision) of the package and the packages it uses.
+namespace LOFAR {
+  class StationCUVersion
+  {
+  public:
+    // Get the info for this package.
+    static Version getInfo();
+
+    // Get the version number of the package (as given in repository).
+    static std::string getVersion();
+    // Get the svn version number of the package according to configure.in.
+    static std::string getConfVersion();
+    // Get the global revision number of the package.
+    static std::string getRevision();
+    // Get the local revision number of the package.
+    static std::string getPackageRevision();
+    // Get the number of files differing from repository.
+    // Usually this is blank, but it can tell the nr of changed files.
+    static std::string getNrChangedFiles();
+    // Get the date/time the package was built (in fact, configured).
+    static std::string getBuildTime();
+    // Get the name of the user who built the package.
+    static std::string getBuildUser();
+    // Get the machine the package was built on.
+    static std::string getBuildMachine();
+
+    // Append the vector with the vinfo of this package and used packages.
+    static void fillInfo (int level,
+			  std::vector<Version::PkgInfo>& vec);
+  };
+}
+
+#endif
diff --git a/MAC/APL/StationCU/include/Makefile.am b/MAC/APL/StationCU/include/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..0a329cd8b8eec63aa7f76fc3ecaa0351e7d345d3
--- /dev/null
+++ b/MAC/APL/StationCU/include/Makefile.am
@@ -0,0 +1,5 @@
+
+SUBDIRS = APL/ClockProtocol
+
+include $(top_srcdir)/Makefile.common
+
diff --git a/MAC/APL/StationCU/src/BeamControl/BeamControl.cc b/MAC/APL/StationCU/src/BeamControl/BeamControl.cc
index be29f7e81df9140cd39986c80d440a5afd338240..c0eaf4bef891bd4e4784042dfa1cb598e7da8f86 100644
--- a/MAC/APL/StationCU/src/BeamControl/BeamControl.cc
+++ b/MAC/APL/StationCU/src/BeamControl/BeamControl.cc
@@ -590,7 +590,7 @@ GCFEvent::TResult BeamControl::quiting_state(GCFEvent& event, GCFPortInterface&
 	}
 	
 	case F_TIMER:
-		GCFTask::stop();
+		GCFScheduler::instance()->stop();
 		break;
 
 	default:
diff --git a/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc b/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc
index a482022d713b0ef1be3ee56f5a367f05b21af256..e309ff0d9acfd30213827a85aa87a0a348357045 100644
--- a/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc
+++ b/MAC/APL/StationCU/src/BeamControl/BeamControlMain.cc
@@ -31,7 +31,7 @@ using namespace LOFAR::StationCU;
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
-	GCFTask::init(argc, argv, argv[1]);
+	GCFScheduler::instance()->init(argc, argv, argv[1]);
 
 	ParentControl*	pc = ParentControl::instance();
 	pc->start();	// make initial transition
@@ -39,7 +39,7 @@ int main(int argc, char* argv[])
 	BeamControl	bc(argv[1]);
 	bc.start(); 	// make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.cc b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.cc
index 5dd936aff5a75d97b259a1479e561b75426f40ae..e6b938e6943cac84b032de0fe79b216e27029ff8 100644
--- a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.cc
+++ b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.cc
@@ -600,7 +600,7 @@ GCFEvent::TResult CalibrationControl::quiting_state(GCFEvent& 		  event,
 	break;
 
 	case F_TIMER:
-		GCFTask::stop();
+		GCFScheduler::instance()->stop();
 		break;
 
 	default:
diff --git a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc
index b0c58e856d02302b786e14d14eabd03c4243fd55..d78ef29546afc30c2911f5f1ab0f5bfdccaa6ea5 100644
--- a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc
+++ b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlMain.cc
@@ -31,7 +31,7 @@ using namespace LOFAR::StationCU;
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
-	GCFTask::init(argc, argv, argv[1]);
+	GCFScheduler::instance()->init(argc, argv, argv[1]);
 
 	ParentControl*	pc = ParentControl::instance();
 	pc->start();	// make initial transition
@@ -39,7 +39,7 @@ int main(int argc, char* argv[])
 	CalibrationControl	cc(argv[1]);
 	cc.start(); 	// make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/APL/StationCU/src/ClockControl/ClockControl.cc b/MAC/APL/StationCU/src/ClockControl/ClockControl.cc
index f8127c57c264c2c854afc1383bbfb9a69e013cf6..c0195d98e52645b18f0b5b9d89af3271184720c0 100644
--- a/MAC/APL/StationCU/src/ClockControl/ClockControl.cc
+++ b/MAC/APL/StationCU/src/ClockControl/ClockControl.cc
@@ -781,7 +781,7 @@ GCFEvent::TResult ClockControl::finishing_state(GCFEvent& event, GCFPortInterfac
 	}
   
     case F_TIMER:
-      GCFTask::stop();
+      GCFScheduler::instance()->stop();
       break;
     
 	default:
diff --git a/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc b/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc
index d79de31cd11f15b448e0c9e3e8c6045e65b54295..d7b8a5b121fb8e827964d6bf898c0d56db651c62 100644
--- a/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc
+++ b/MAC/APL/StationCU/src/ClockControl/ClockControlMain.cc
@@ -35,7 +35,7 @@ int main(int argc, char* argv[])
 	}
 
 	// args: cntlrname, parentHost, parentService
-	GCFTask::init(argc, argv, "ClockControl");
+	GCFScheduler::instance()->init(argc, argv, "ClockControl");
 
 	ParentControl*	pc = ParentControl::instance();
 	pc->start();	// make initial transition
@@ -43,7 +43,7 @@ int main(int argc, char* argv[])
 	ClockControl	cc(argv[1]);
 	cc.start(); 	// make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/APL/StationCU/src/HardwareMonitor/ECMonitor.cc b/MAC/APL/StationCU/src/HardwareMonitor/ECMonitor.cc
index a20be2acafedd36c9334b45f0d346d71f30e9e14..ddc3214b69fe675beba72b92d93757bb28910712 100644
--- a/MAC/APL/StationCU/src/HardwareMonitor/ECMonitor.cc
+++ b/MAC/APL/StationCU/src/HardwareMonitor/ECMonitor.cc
@@ -685,7 +685,7 @@ GCFEvent::TResult RawEvent::dispatch(GCFTask& task, GCFPortInterface& port)
   hexdump(hd,&buf,sizeof(buf));
   LOG_DEBUG_STR("raw buf all=" << hd);
   // dispatch the EC message as a GCFEvent (which it now is)
-  status = task.dispatch(buf.event, port);
+  status = task.doEvent(buf.event, port);
   
   return(status);
 }
diff --git a/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc b/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc
index 627f8fbe7ef1760ae34f11fcaf546dcd7be7201c..d15b46744d9b292b59fa94247aed48e5c498592e 100644
--- a/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc
+++ b/MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitorMain.cc
@@ -40,7 +40,7 @@ using namespace LOFAR::StationCU;
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
-	GCFTask::init(argc, argv, "HardwareMonitor");
+	GCFScheduler::instance()->init(argc, argv, "HardwareMonitor");
 
 	LOG_INFO("MACProcessScope: LOFAR_PermSW_HardwareMonitor");
 	LOG_INFO(Version::getInfo<StationCUVersion>("HardwareMonitor"));
@@ -84,8 +84,8 @@ int main(int argc, char* argv[])
 	}
 
 	// ok, we have something to do, do it.
-	GCFTask::setDelayedQuit(true);	// we need a clean shutdown
-	GCFTask::run();	// until stop was called
+	GCFScheduler::instance()->setDelayedQuit(true);	// we need a clean shutdown
+	GCFScheduler::instance()->run();	// until stop was called
 
 	if (rsp) {
 		rsp->quit();		// let task quit nicely
@@ -97,7 +97,7 @@ int main(int argc, char* argv[])
 		ec->quit();		   // let task quit nicely
 	}
 	double	postRunTime = globalParameterSet()->getDouble("closingDelay", 1.5);
-	GCFTask::run(postRunTime);	// let processes die.
+	GCFScheduler::instance()->run(postRunTime);	// let processes die.
 
 	return (0);
 }
diff --git a/MAC/APL/StationCU/src/StationControl/ActiveObs.cc b/MAC/APL/StationCU/src/StationControl/ActiveObs.cc
index 6211db3abefddc6971dbf917c3ebe29b15956493..2d3d28f2c99a72d70c112bc4a6fc8cef753e628e 100644
--- a/MAC/APL/StationCU/src/StationControl/ActiveObs.cc
+++ b/MAC/APL/StationCU/src/StationControl/ActiveObs.cc
@@ -229,7 +229,7 @@ GCFEvent::TResult	ActiveObs::starting(GCFEvent&	event, GCFPortInterface&	port)
 		CONTROLQuitedEvent		msg(event);
 		LOG_FATAL_STR("Controller " << msg.cntlrName << " died unexpectedly. Aborting observation");
 		TRAN(ActiveObs::stopping);
-		dispatch(event, port);
+		doEvent(event, port);
 	}
 	break;
 
@@ -320,7 +320,7 @@ GCFEvent::TResult	ActiveObs::connected(GCFEvent&	event, GCFPortInterface&	port)
 		CONTROLQuitedEvent		msg(event);
 		LOG_FATAL_STR("Controller " << msg.cntlrName << " died unexpectedly. Aborting observation");
 		TRAN(ActiveObs::stopping);
-		dispatch(event, port);
+		doEvent(event, port);
 	}
 	break;
 
@@ -414,7 +414,7 @@ GCFEvent::TResult	ActiveObs::standby(GCFEvent&	event, GCFPortInterface&	port)
 		CONTROLQuitedEvent		msg(event);
 		LOG_FATAL_STR("Controller " << msg.cntlrName << " died unexpectedly. Aborting observation");
 		TRAN(ActiveObs::stopping);
-		dispatch(event, port);
+		doEvent(event, port);
 	}
 	break;
 
@@ -553,7 +553,7 @@ GCFEvent::TResult	ActiveObs::operational(GCFEvent&	event, GCFPortInterface&	port
 		CONTROLQuitedEvent		msg(event);
 		LOG_FATAL_STR("Controller " << msg.cntlrName << " died unexpectedly. Aborting observation");
 		TRAN(ActiveObs::stopping);
-		dispatch(event, port);
+		doEvent(event, port);
 	}
 	break;
 
diff --git a/MAC/APL/StationCU/src/StationControl/StationControl.cc b/MAC/APL/StationCU/src/StationControl/StationControl.cc
index dcd37e270e6b313ebd4df58b4fa31876dafe8db5..e1762727342386202a0bc04ace65cfc09f0b3fbe 100644
--- a/MAC/APL/StationCU/src/StationControl/StationControl.cc
+++ b/MAC/APL/StationCU/src/StationControl/StationControl.cc
@@ -486,12 +486,12 @@ GCFEvent::TResult StationControl::operational_state(GCFEvent& event, GCFPortInte
 						" should have died by now, sending an extra QUIT command.");
 			CONTROLQuitEvent	quitevent;
 			quitevent.cntlrName = theObs->second->getName();
-			theObs->second->dispatch(quitevent, port);
+			theObs->second->doEvent(quitevent, port);
 		}
 
 		// pass event to observation FSM
 		LOG_TRACE_FLOW("Dispatch to observation FSM's");
-		theObs->second->dispatch(event, port);
+		theObs->second->doEvent(event, port);
 		LOG_TRACE_FLOW("Back from dispatch");
 	}
 	break;
@@ -581,7 +581,7 @@ LOG_DEBUG_STR("inSync = " << (theObs->second->inSync() ? "true" : "false"));
 #endif
 		// pass event to observation FSM
 		LOG_TRACE_FLOW("Dispatch to observation FSM's");
-		theObs->second->dispatch(event, port);
+		theObs->second->doEvent(event, port);
 
 		// end of FSM?
 		if (event.signal == CONTROL_QUITED && theObs->second->isReady()) {
@@ -666,7 +666,7 @@ GCFEvent::TResult StationControl::finishing_state(GCFEvent& event, GCFPortInterf
 	}
   
     case F_TIMER:
-      GCFTask::stop();
+      GCFScheduler::instance()->stop();
       break;
     
 	default:
diff --git a/MAC/APL/StationCU/src/StationControl/StationControlMain.cc b/MAC/APL/StationCU/src/StationControl/StationControlMain.cc
index e05e6bed3af3c48d1e6630a6ca88b68e2812ad60..85173ae7f2a4bd8d422a8b159c96a309fc9b4860 100644
--- a/MAC/APL/StationCU/src/StationControl/StationControlMain.cc
+++ b/MAC/APL/StationCU/src/StationControl/StationControlMain.cc
@@ -36,7 +36,7 @@ using namespace LOFAR::StationCU;
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
-	GCFTask::init(argc, argv, basename(argv[0]));
+	GCFScheduler::instance()->init(argc, argv, basename(argv[0]));
 
 	ParentControl*	pc = ParentControl::instance();
 	pc->start();	// make initial transition
@@ -54,7 +54,7 @@ int main(int argc, char* argv[])
 	StationControl	sc(myName.c_str());
 	sc.start(); 	// make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/APL/StationCU/src/TBBControl/TBBControl.cc b/MAC/APL/StationCU/src/TBBControl/TBBControl.cc
index c338608ec9faf1d9f37e7f0b174bf403cd380400..4719807a5bbd6bad613f0887f0b9355e832bc599 100644
--- a/MAC/APL/StationCU/src/TBBControl/TBBControl.cc
+++ b/MAC/APL/StationCU/src/TBBControl/TBBControl.cc
@@ -1288,7 +1288,7 @@ GCFEvent::TResult TBBControl::quiting_state(GCFEvent& event, GCFPortInterface& p
 		} break;
 		
 		case F_TIMER: {
-			GCFTask::stop();
+			GCFScheduler::instance()->stop();
 		} break;
 	
 		default: {
diff --git a/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc b/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc
index b4192ad46da105f0163d916aef446f582ee861a6..21080f5dd95a04af544b48909a658b6c006c64e3 100644
--- a/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc
+++ b/MAC/APL/StationCU/src/TBBControl/TBBControlMain.cc
@@ -32,7 +32,7 @@ using namespace LOFAR::StationCU;
 int main(int argc, char* argv[])
 {
 	// args: cntlrname, parentHost, parentService
-	GCFTask::init(argc, argv, argv[0]);
+	GCFScheduler::instance()->init(argc, argv, argv[0]);
 
 	ParentControl*	pc = ParentControl::instance();
 	pc->start();	// make initial transition
@@ -43,7 +43,7 @@ int main(int argc, char* argv[])
 	VHECRTask*		vt(VHECRTask::instance());
 	//vt->start();
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/APL/TestCtlr/src/ControllerMenu.cc b/MAC/APL/TestCtlr/src/ControllerMenu.cc
index 2e7723098f4a70094f09f243fe27c9c68ca36cdb..c6c71bc4792c208b9fb29d29edc7743a895481ca 100644
--- a/MAC/APL/TestCtlr/src/ControllerMenu.cc
+++ b/MAC/APL/TestCtlr/src/ControllerMenu.cc
@@ -146,7 +146,7 @@ GCFEvent::TResult ControllerMenu::startup_state(GCFEvent& event, GCFPortInterfac
 											 itsInstanceNr,
 											 myHostname(false))) {
 				cout << "Error during start of controller, bailing out" << endl;
-				stop();
+				GCFScheduler::instance()->stop();
 			}
 			cout << endl << "Startrequest queued, waiting for confirmation...";
 		}
@@ -165,7 +165,7 @@ GCFEvent::TResult ControllerMenu::startup_state(GCFEvent& event, GCFPortInterfac
 			}
 			else {
 				cout << endl << "StartDaemon could not start the controller, bailing out." << endl;
-				stop();
+				GCFScheduler::instance()->stop();
 			}
 		}
 		break;
@@ -175,7 +175,7 @@ GCFEvent::TResult ControllerMenu::startup_state(GCFEvent& event, GCFPortInterfac
 			cout << endl << "Connection result = " << msg.result << endl;
 			if (msg.result != CT_RESULT_NO_ERROR) {
 				cout << "Bailing out because of the errors." << endl;
-				stop ();
+				GCFScheduler::instance()->stop ();
 			}
 			else {
 				_doActionMenu();	// does a TRAN
@@ -210,7 +210,7 @@ GCFEvent::TResult ControllerMenu::claim_state(GCFEvent& event, GCFPortInterface&
 			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->requestState(CTState::CLAIMED, cntlrName, itsObsNr, itsCntlrType)) {
 				cout << "Error during state request, bailing out" << endl;
-				stop();
+				GCFScheduler::instance()->stop();
 			}
 		}
    		break;
@@ -225,7 +225,7 @@ GCFEvent::TResult ControllerMenu::claim_state(GCFEvent& event, GCFPortInterface&
 			cout << endl << "Claim result = " << msg.result << endl;
 			if (msg.result != CT_RESULT_NO_ERROR) {
 				cout << "Bailing out because of the errors." << endl;
-				stop ();
+				GCFScheduler::instance()->stop ();
 			}
 			else {
 				_doActionMenu();
@@ -261,7 +261,7 @@ GCFEvent::TResult ControllerMenu::prepare_state(GCFEvent& event, GCFPortInterfac
 			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->requestState(CTState::PREPARED, cntlrName, itsObsNr, itsCntlrType)) {
 				cout << "Error during state request, bailing out" << endl;
-				stop();
+				GCFScheduler::instance()->stop();
 			}
 		}
    		break;
@@ -276,7 +276,7 @@ GCFEvent::TResult ControllerMenu::prepare_state(GCFEvent& event, GCFPortInterfac
 			cout << endl << "Prepare result = " << msg.result << endl;
 			if (msg.result != CT_RESULT_NO_ERROR) {
 				cout << "Bailing out because of the errors." << endl;
-				stop ();
+				GCFScheduler::instance()->stop ();
 			}
 			else {
 				_doActionMenu();
@@ -311,7 +311,7 @@ GCFEvent::TResult ControllerMenu::run_state(GCFEvent& event, GCFPortInterface& /
 			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->requestState(CTState::RESUMED, cntlrName, itsObsNr, itsCntlrType)) {
 				cout << "Error during state request, bailing out" << endl;
-				stop();
+				GCFScheduler::instance()->stop();
 			}
 		}
    		break;
@@ -326,7 +326,7 @@ GCFEvent::TResult ControllerMenu::run_state(GCFEvent& event, GCFPortInterface& /
 			cout << endl << "Resume result = " << msg.result << endl;
 			if (msg.result != CT_RESULT_NO_ERROR) {
 				cout << "Bailing out because of the errors." << endl;
-				stop ();
+				GCFScheduler::instance()->stop ();
 			}
 			else {
 				_doActionMenu();
@@ -361,7 +361,7 @@ GCFEvent::TResult ControllerMenu::suspend_state(GCFEvent& event, GCFPortInterfac
 			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->requestState(CTState::SUSPENDED, cntlrName, itsObsNr, itsCntlrType)) {
 				cout << "Error during state request, bailing out" << endl;
-				stop();
+				GCFScheduler::instance()->stop();
 			}
 		}
    		break;
@@ -376,7 +376,7 @@ GCFEvent::TResult ControllerMenu::suspend_state(GCFEvent& event, GCFPortInterfac
 			cout << endl << "Suspend result = " << msg.result << endl;
 			if (msg.result != CT_RESULT_NO_ERROR) {
 				cout << "Bailing out because of the errors." << endl;
-				stop ();
+				GCFScheduler::instance()->stop ();
 			}
 			else {
 				_doActionMenu();
@@ -411,7 +411,7 @@ GCFEvent::TResult ControllerMenu::release_state(GCFEvent& event, GCFPortInterfac
 			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->requestState(CTState::RELEASED, cntlrName, itsObsNr, itsCntlrType)) {
 				cout << "Error during state request, bailing out" << endl;
-				stop();
+				GCFScheduler::instance()->stop();
 			}
 		}
    		break;
@@ -426,7 +426,7 @@ GCFEvent::TResult ControllerMenu::release_state(GCFEvent& event, GCFPortInterfac
 			cout << endl << "Release result = " << msg.result << endl;
 			if (msg.result != CT_RESULT_NO_ERROR) {
 				cout << "Bailing out because of the errors." << endl;
-				stop ();
+				GCFScheduler::instance()->stop ();
 			}
 			else {
 				_doActionMenu();
@@ -461,7 +461,7 @@ GCFEvent::TResult ControllerMenu::finish_state(GCFEvent& event, GCFPortInterface
 			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->requestState(CTState::QUITED, cntlrName, itsObsNr, itsCntlrType)) {
 				cout << "Error during state request, bailing out" << endl;
-				stop();
+				GCFScheduler::instance()->stop();
 			}
 		}
    		break;
@@ -527,7 +527,7 @@ int16 ControllerMenu::_chooseController()
 	}
 
 	if (CntlrType == 0) {
-		stop();
+		GCFScheduler::instance()->stop();
 	}
 	
 	return (CntlrType + 1);
@@ -551,7 +551,7 @@ void ControllerMenu::_doStartMenu()
 		cin.clear();
 		cin >> obsnr;
 		if (obsnr == 0) {
-			stop();
+			GCFScheduler::instance()->stop();
 			return;
 		}
 		ifstream	iFile;
@@ -618,7 +618,7 @@ void ControllerMenu::_doActionMenu()
 			return;
 			break;
 		case 'q':
-			stop();
+			GCFScheduler::instance()->stop();
 			break;
 		default:
 			command = "";
diff --git a/MAC/APL/TestCtlr/src/ControllerMenuMain.cc b/MAC/APL/TestCtlr/src/ControllerMenuMain.cc
index ead16f3258c5064cb882a30f913ae65386014ce9..c0f9b369f3677b079d8dddf9c292040d63e9cf17 100644
--- a/MAC/APL/TestCtlr/src/ControllerMenuMain.cc
+++ b/MAC/APL/TestCtlr/src/ControllerMenuMain.cc
@@ -30,7 +30,7 @@ using namespace LOFAR::Test;
 
 int main(int argc, char* argv[])
 {
-	GCFTask::init(argc, argv, "ControllerMenu");
+	GCFScheduler::instance()->init(argc, argv, "ControllerMenu");
 
 	ChildControl*	cc = ChildControl::instance();
 	cc->start();	// make initial transition
@@ -38,7 +38,7 @@ int main(int argc, char* argv[])
 	ControllerMenu	tc(argc == 2 ? atoi(argv[1]) : 0);
 	tc.start(); // make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/APL/TestCtlr/src/TestControllerMain.cc b/MAC/APL/TestCtlr/src/TestControllerMain.cc
index 80983fa8f8d7ccb01a59cc00ff3aa2e0dbb368c9..fe7bc45c6c40670b2136e060aecc4b1dabefea32 100644
--- a/MAC/APL/TestCtlr/src/TestControllerMain.cc
+++ b/MAC/APL/TestCtlr/src/TestControllerMain.cc
@@ -30,7 +30,7 @@ using namespace LOFAR::Test;
 
 int main(int argc, char* argv[])
 {
-	GCFTask::init(argc, argv);
+	GCFScheduler::instance()->init(argc, argv);
 
 	ParentControl*	pc = ParentControl::instance();
 	pc->start();	// make initial transition
@@ -38,7 +38,7 @@ int main(int argc, char* argv[])
 	TestController	tc(argv[1]);
 	tc.start(); // make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/Deployment/data/PVSS/Adder.dpdef b/MAC/Deployment/data/PVSS/Adder.dpdef
index cee95b62c767506b8e18cff95c9392db1c34285d..77cd612ea685f13e0c377e9b95bc9420401c48aa 100644
--- a/MAC/Deployment/data/PVSS/Adder.dpdef
+++ b/MAC/Deployment/data/PVSS/Adder.dpdef
@@ -1,4 +1,3 @@
 # Adder
-dropping		bool
+dropping			bool
 nrBlocksDropped		int
-
diff --git a/MAC/GCF/PVSS/src/GSA_SCADAHandler.cc b/MAC/GCF/PVSS/src/GSA_SCADAHandler.cc
index 5d91d59af892b2e84a984d3744d67c9a1a9ec50f..556c9c6703becac5bb2a27b6e0bf1ae42ce3f17b 100644
--- a/MAC/GCF/PVSS/src/GSA_SCADAHandler.cc
+++ b/MAC/GCF/PVSS/src/GSA_SCADAHandler.cc
@@ -26,7 +26,7 @@
 
 #include "GSA_SCADAHandler.h"
 #include <GSA_Resources.h>
-#include <GCF/TM/GCF_Task.h>
+#include <GCF/TM/GCF_Scheduler.h>
 //#include <Common/ParameterSet.h>
 
 namespace LOFAR {
@@ -38,8 +38,8 @@ GSASCADAHandler* GSASCADAHandler::instance()
 {
   if (0 == _pInstance) {
     string cmdline;
-    for (int i = 0; i < GCFTask::_argc; i++) {
-      cmdline += GCFTask::_argv[i];
+    for (int i = 0; i < TM::GCFScheduler::_argc; i++) {
+      cmdline += TM::GCFScheduler::_argv[i];
       cmdline += " ";
     }
     cmdline += "-currentproj ";
@@ -47,9 +47,9 @@ GSASCADAHandler* GSASCADAHandler::instance()
 //#define PARAM_PVSS_CMDLINE "mac.%s.pvss.cmdline"
 //#define PARAM_DEFAULT_PVSS_CMDLINE "mac.controller.pvss.cmdline"
 //    string pvssCmdLineParam = PARAM_DEFAULT_PVSS_CMDLINE;
-//    char* appName = strrchr(GCFTask::_argv[0], '/');
+//    char* appName = strrchr(GCFScheduler::_argv[0], '/');
 //    if (!globalParameterSet()->isDefined(pvssCmdLineParam)) {            
-//      pvssCmdLineParam = formatString(PARAM_PVSS_CMDLINE, (appName ? appName + 1 : GCFTask::_argv[0]));
+//      pvssCmdLineParam = formatString(PARAM_PVSS_CMDLINE, (appName ? appName + 1 : GCFScheduler::_argv[0]));
 //    }
 //    if (globalParameterSet()->isDefined(pvssCmdLineParam)) {
 //      cmdline += globalParameterSet()->getString(pvssCmdLineParam);
diff --git a/MAC/GCF/PVSS/src/GSA_SCADAHandler.h b/MAC/GCF/PVSS/src/GSA_SCADAHandler.h
index b87b19bda913b45c678f20ad85da95aa4a3a9708..2c11b0bd71992f6c6ca6f52a772715d6e2dea016 100644
--- a/MAC/GCF/PVSS/src/GSA_SCADAHandler.h
+++ b/MAC/GCF/PVSS/src/GSA_SCADAHandler.h
@@ -37,7 +37,7 @@ namespace LOFAR {
  * uses the PVSS API. It calls the dispatch of the PVSS API to handle incoming 
  * and outgoing messages from/to PVSS.
  */
-class GSASCADAHandler : GCFHandler
+class GSASCADAHandler : TM::GCFHandler
 {
 public:
     static GSASCADAHandler* instance ();
diff --git a/MAC/GCF/PVSS/test/tMonitorState.cc b/MAC/GCF/PVSS/test/tMonitorState.cc
index 162368af5e8a7b40b9eeffde7907ba8038cace4a..265299b507400503282f248568b6e9116c0b1c00 100644
--- a/MAC/GCF/PVSS/test/tMonitorState.cc
+++ b/MAC/GCF/PVSS/test/tMonitorState.cc
@@ -112,7 +112,7 @@ GCFEvent::TResult tMonitorState::final(GCFEvent& e, GCFPortInterface& /*p*/)
 
 	switch (e.signal) {
 	case F_ENTRY:
-		stop();
+		GCFScheduler::instance()->stop();
 		break;
 
 	default:
@@ -160,12 +160,12 @@ using namespace LOFAR::GCF;
 
 int main(int argc, char* argv[])
 {
-	TM::GCFTask::init(argc, argv);
+	TM::GCFScheduler::instance()->init(argc, argv);
 
 	PVSS::tMonitorState test_task("QueryTest");  
 	test_task.start(); // make initial transition
 
-	TM::GCFTask::run();
+	TM::GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/GCF/PVSS/test/tMonitorState.h b/MAC/GCF/PVSS/test/tMonitorState.h
index d096242ae4bf718e73379ce3231dd0b35cd10d7e..d58b05d23a21099b56a1f3257c2e2fa1169c51cc 100644
--- a/MAC/GCF/PVSS/test/tMonitorState.h
+++ b/MAC/GCF/PVSS/test/tMonitorState.h
@@ -30,6 +30,8 @@
 
 namespace LOFAR {
  namespace GCF {
+  using TM::GCFTask;
+  using TM::GCFTimerPort;
   namespace PVSS {
 /**
  * The tMonitorState task receives ECHO_PING events from the Ping task and
diff --git a/MAC/GCF/PVSS/test/tPVSSservice.cc b/MAC/GCF/PVSS/test/tPVSSservice.cc
index 6bde47227599ae832e22c48fe24402558afcf570..7664937eaff93da7cf214762cc5e831c15c996fc 100644
--- a/MAC/GCF/PVSS/test/tPVSSservice.cc
+++ b/MAC/GCF/PVSS/test/tPVSSservice.cc
@@ -136,7 +136,7 @@ GCFEvent::TResult tGSAService::final(GCFEvent& e, GCFPortInterface& /*p*/)
 		break;
 	
 	case F_TIMER:
-		stop();
+		GCFScheduler::instance()->stop();
 		break;
 
 	default:
@@ -751,12 +751,12 @@ using namespace LOFAR::GCF;
 
 int main(int argc, char* argv[])
 {
-	TM::GCFTask::init(argc, argv);
+	TM::GCFScheduler::instance()->init(argc, argv);
 
 	PVSS::tGSAService test_task("SALtest");  
 	test_task.start(); // make initial transition
 
-	TM::GCFTask::run();
+	TM::GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/GCF/PVSS/test/tPVSSservice.h b/MAC/GCF/PVSS/test/tPVSSservice.h
index e840fb43720f26eac21c974573b3da609752d508..707af001125b8956a584f9a22bfa9de7face389c 100644
--- a/MAC/GCF/PVSS/test/tPVSSservice.h
+++ b/MAC/GCF/PVSS/test/tPVSSservice.h
@@ -30,6 +30,8 @@
 
 namespace LOFAR {
  namespace GCF {
+  using TM::GCFTask;
+  using TM::GCFPortInterface;
   namespace PVSS {
 /**
  * The tGSAService task receives ECHO_PING events from the Ping task and
@@ -74,9 +76,9 @@ class tGSAService : public GCFTask
    * task are received on the server port. And reply events to the Ping task
    * are sent through the server port.
    */
-	PVSSservice* 	itsService;;
-	PVSSresponse*	itsResponse;
-	GCFTimerPort*	itsTimerPort;
+	PVSSservice* 		itsService;;
+	PVSSresponse*		itsResponse;
+	TM::GCFTimerPort*	itsTimerPort;
 };
 
   } // namespace PVSS
diff --git a/MAC/GCF/PVSS/test/tPerformance.cc b/MAC/GCF/PVSS/test/tPerformance.cc
index 3336fb1980b7ba5768d88a9a5f1a6e36d20e3ba4..b9b30550da72cf752761e004497f5d2d8a2f838c 100644
--- a/MAC/GCF/PVSS/test/tPerformance.cc
+++ b/MAC/GCF/PVSS/test/tPerformance.cc
@@ -111,7 +111,7 @@ GCFEvent::TResult tPerformance::final(GCFEvent& e, GCFPortInterface& /*p*/)
 		break;
 	
 	case F_TIMER:
-		stop();
+		GCFScheduler::instance()->stop();
 		break;
 
 	default:
@@ -396,12 +396,12 @@ int main(int argc, char* argv[])
 		NR_OF_DPS = 10;
 	}
 
-	TM::GCFTask::init(argc, argv);
+	GCFScheduler::instance()->init(argc, argv);
 
 	PVSS::tPerformance test_task("SALSpeedTest");  
 	test_task.start(); // make initial transition
 
-	TM::GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/GCF/PVSS/test/tPerformance.h b/MAC/GCF/PVSS/test/tPerformance.h
index 378351b6538edc9072e1b46e3121dce56dbb0ff5..84d34bcc5dd61ee662784b905e4cedf8b6b3f763 100644
--- a/MAC/GCF/PVSS/test/tPerformance.h
+++ b/MAC/GCF/PVSS/test/tPerformance.h
@@ -31,6 +31,9 @@
 
 namespace LOFAR {
  namespace GCF {
+  using TM::GCFTask;
+  using TM::GCFPortInterface;
+  using TM::GCFTimerPort;
   namespace PVSS {
 /**
  * The tPerformance task receives ECHO_PING events from the Ping task and
diff --git a/MAC/GCF/RTDB/src/DPanswer.cc b/MAC/GCF/RTDB/src/DPanswer.cc
index 63a5cbea5576ee4964dcf88a594049a1fe6fc51c..f9514c8bdbe6e079401f473dacbb976ad7465601 100644
--- a/MAC/GCF/RTDB/src/DPanswer.cc
+++ b/MAC/GCF/RTDB/src/DPanswer.cc
@@ -24,6 +24,7 @@
 #include <Common/LofarLogger.h>	
 
 #include <MACIO/GCF_Event.h>
+#include <GCF/TM/GCF_Scheduler.h>
 #include <DP_Protocol.ph>
 #include "DPanswer.h"
 
@@ -166,7 +167,7 @@ void DPanswer::_dispatchEvent(GCFEvent&	event)
 	memcpy(newEventBuffer + GCFEVENT_LEN, packedBuffer + sizeof(signal) + sizeof(length), length);
 
 	// Finally we can send the reconstructed event.
-	itsTask->dispatch(*pActualEvent, gDummyPort);
+	itsTask->doEvent(*pActualEvent, gDummyPort);
 
 	// and delete it again.
 	delete newEventBuffer;
diff --git a/MAC/GCF/RTDB/test/tDPservice.cc b/MAC/GCF/RTDB/test/tDPservice.cc
index 4b6094e0d8f0c7b21eca0781453355d391b65223..54d11813d403e4031467e18a94825a4eb0a55c14 100644
--- a/MAC/GCF/RTDB/test/tDPservice.cc
+++ b/MAC/GCF/RTDB/test/tDPservice.cc
@@ -131,7 +131,7 @@ GCFEvent::TResult tDPservice::final(GCFEvent& e, GCFPortInterface& /*p*/)
 		break;
 	
 	case F_TIMER:
-		stop();
+		GCFScheduler::instance()->stop();
 		break;
 
 	default:
@@ -381,12 +381,12 @@ using namespace LOFAR::GCF;
 
 int main(int argc, char* argv[])
 {
-	TM::GCFTask::init(argc, argv);
+	TM::GCFScheduler::instance()->init(argc, argv);
 
 	RTDB::tDPservice test_task("DPStest");  
 	test_task.start(); // make initial transition
 
-	TM::GCFTask::run();
+	TM::GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/GCF/RTDB/test/tDPservice.h b/MAC/GCF/RTDB/test/tDPservice.h
index 05766104de40ae55dc55c0174d89b9414844092b..51099722dcb0836d03d056f9af82390621014206 100644
--- a/MAC/GCF/RTDB/test/tDPservice.h
+++ b/MAC/GCF/RTDB/test/tDPservice.h
@@ -29,6 +29,9 @@
 
 namespace LOFAR {
  namespace GCF {
+  using TM::GCFTask;
+  using TM::GCFPortInterface;
+  using TM::GCFTimerPort;
   namespace RTDB {
 
 class tDPservice : public GCFTask
diff --git a/MAC/GCF/RTDB/test/tPerformanceReport.cc b/MAC/GCF/RTDB/test/tPerformanceReport.cc
index 761f1c3e29e4c4e97eca492bae92c9a3b69200d1..3325521f4566d618a6327e4dce1e90ecccae3582 100644
--- a/MAC/GCF/RTDB/test/tPerformanceReport.cc
+++ b/MAC/GCF/RTDB/test/tPerformanceReport.cc
@@ -116,7 +116,7 @@ GCFEvent::TResult tPerformance::final(GCFEvent& e, GCFPortInterface& /*p*/)
 		break;
 	
 	case F_TIMER:
-		stop();
+		GCFScheduler::instance()->stop();
 		break;
 
 	default:
@@ -365,12 +365,12 @@ int main(int argc, char* argv[])
 	NR_OF_DPS = 1;
 	NR_OF_ACTIONS = 1000;
 
-	TM::GCFTask::init(argc, argv);
+	TM::GCFScheduler::instance()->init(argc, argv);
 
 	RTDB::tPerformance test_task("PVSSperformanceTest");  
 	test_task.start(); // make initial transition
 
-	TM::GCFTask::run();
+	TM::GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/GCF/RTDB/test/tPerformanceReport.h b/MAC/GCF/RTDB/test/tPerformanceReport.h
index bdd54a4f541794e1afe57323737a50cf1922d847..12d3baa0b1c6fed174ca79e7fbfa54e81b38e43e 100644
--- a/MAC/GCF/RTDB/test/tPerformanceReport.h
+++ b/MAC/GCF/RTDB/test/tPerformanceReport.h
@@ -32,6 +32,9 @@
 
 namespace LOFAR {
  namespace GCF {
+  using TM::GCFTask;
+  using TM::GCFPortInterface;
+  using TM::GCFTimerPort;
   namespace RTDB {
 /**
  * The tPerformance task receives ECHO_PING events from the Ping task and
diff --git a/MAC/GCF/RTDB/test/tPropertySet.cc b/MAC/GCF/RTDB/test/tPropertySet.cc
index 4b45ada527e228142b08255e07c12bea4fff0406..2a53ceafeb7f361c1e7d24bc7b5002aa3355e56d 100644
--- a/MAC/GCF/RTDB/test/tPropertySet.cc
+++ b/MAC/GCF/RTDB/test/tPropertySet.cc
@@ -126,7 +126,7 @@ GCFEvent::TResult tPropertySet::final(GCFEvent& e, GCFPortInterface& /*p*/)
 		break;
 	
 	case F_TIMER:
-		stop();
+		GCFScheduler::instance()->stop();
 		break;
 
 	default:
@@ -461,12 +461,12 @@ using namespace LOFAR::GCF;
 
 int main(int argc, char* argv[])
 {
-	TM::GCFTask::init(argc, argv);
+	TM::GCFScheduler::instance()->init(argc, argv);
 
 	RTDB::tPropertySet test_task("PStest");  
 	test_task.start(); // make initial transition
 
-	TM::GCFTask::run();
+	TM::GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/GCF/RTDB/test/tPropertySet.h b/MAC/GCF/RTDB/test/tPropertySet.h
index 25a6f255fdca95609e4ad15e3220458baa09bd3a..e49e5083ecdb2d9f17ef7e0bda3a04a5006706c6 100644
--- a/MAC/GCF/RTDB/test/tPropertySet.h
+++ b/MAC/GCF/RTDB/test/tPropertySet.h
@@ -29,6 +29,9 @@
 
 namespace LOFAR {
  namespace GCF {
+  using TM::GCFTask;
+  using TM::GCFPortInterface;
+  using TM::GCFTimerPort;
   namespace RTDB {
 
 class tPropertySet : public GCFTask
diff --git a/MAC/GCF/RTDB/test/tRTDBPerformance.cc b/MAC/GCF/RTDB/test/tRTDBPerformance.cc
index d72c584a71f575fd11f2c829c9c2022e129e0bba..b6ee0c201658e2f1c333c4bc31667d0d82a13b3e 100644
--- a/MAC/GCF/RTDB/test/tRTDBPerformance.cc
+++ b/MAC/GCF/RTDB/test/tRTDBPerformance.cc
@@ -113,7 +113,7 @@ GCFEvent::TResult tPerformance::final(GCFEvent& e, GCFPortInterface& /*p*/)
 		break;
 	
 	case F_TIMER:
-		stop();
+		GCFScheduler::instance()->stop();
 		break;
 
 	default:
@@ -394,12 +394,12 @@ int main(int argc, char* argv[])
 		NR_OF_DPS = 10;
 	}
 
-	TM::GCFTask::init(argc, argv);
+	TM::GCFScheduler::instance()->init(argc, argv);
 
 	RTDB::tPerformance test_task("RTDBSpeedTest");  
 	test_task.start(); // make initial transition
 
-	TM::GCFTask::run();
+	TM::GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/GCF/RTDB/test/tRTDBPerformance.h b/MAC/GCF/RTDB/test/tRTDBPerformance.h
index f64f712620fb09c1a32007efc1ea4864b2a9b114..cf522895be7035449c13580d39aff84649097821 100644
--- a/MAC/GCF/RTDB/test/tRTDBPerformance.h
+++ b/MAC/GCF/RTDB/test/tRTDBPerformance.h
@@ -32,6 +32,9 @@
 
 namespace LOFAR {
  namespace GCF {
+  using TM::GCFTask;
+  using TM::GCFPortInterface;
+  using TM::GCFTimerPort;
   namespace RTDB {
 /**
  * The tPerformance task receives ECHO_PING events from the Ping task and
diff --git a/MAC/GCF/RTDB/test/testQuery.cc b/MAC/GCF/RTDB/test/testQuery.cc
index 60849bd88358a1e93c00b7f1c472bdcda3439808..71e562e442776f48a29153f7787f85a8f4e7b7bd 100644
--- a/MAC/GCF/RTDB/test/testQuery.cc
+++ b/MAC/GCF/RTDB/test/testQuery.cc
@@ -90,7 +90,7 @@ GCFEvent::TResult testQuery::final(GCFEvent& e, GCFPortInterface& /*p*/)
 		break;
 	
 	case F_TIMER:
-		stop();
+		GCFScheduler::instance()->stop();
 		break;
 
 	default:
@@ -118,7 +118,7 @@ GCFEvent::TResult testQuery::waitForChanges(GCFEvent& event, GCFPortInterface& /
 		PVSSresult	result = itsDPservice->query(DPclause, whereClause);
 		if (result != SA_NO_ERROR) {
 			LOG_ERROR ("Taking subscription failed. Bailing out.");
-			stop();
+			GCFScheduler::instance()->stop();
 		}
 	}
 	break;
@@ -128,7 +128,7 @@ GCFEvent::TResult testQuery::waitForChanges(GCFEvent& event, GCFPortInterface& /
 		if (answer.result != SA_NO_ERROR) {
 			LOG_ERROR_STR ("Taking subscription on PVSS-states failed (" << answer.result  <<
 								"). Bailing out.");
-			stop();
+			GCFScheduler::instance()->stop();
 			break;
 		}
 		itsQueryID = answer.QryID;
@@ -184,12 +184,12 @@ int main(int argc, char* argv[])
 	DPclause    = argv[1];
 	whereClause = argv[2];
 
-	TM::GCFTask::init(argc, argv);
+	TM::GCFScheduler::instance()->init(argc, argv);
 
 	RTDB::testQuery test_task("DPStest");  
 	test_task.start(); // make initial transition
 
-	TM::GCFTask::run();
+	TM::GCFScheduler::instance()->run();
 
 	return 0;
 }
diff --git a/MAC/GCF/RTDB/test/testQuery.h b/MAC/GCF/RTDB/test/testQuery.h
index 96fb1af3c35f44069020c9e58d3ef605c420aa61..1e89f310c0a8f6aa143998fc7eb48f69a7e970ff 100644
--- a/MAC/GCF/RTDB/test/testQuery.h
+++ b/MAC/GCF/RTDB/test/testQuery.h
@@ -29,6 +29,9 @@
 
 namespace LOFAR {
  namespace GCF {
+  using TM::GCFTask;
+  using TM::GCFPortInterface;
+  using TM::GCFTimerPort;
   namespace RTDB {
 
 class testQuery : public GCFTask
diff --git a/MAC/GCF/TM/include/GCF/TM/GCF_Fsm.h b/MAC/GCF/TM/include/GCF/TM/GCF_Fsm.h
index 72ee2972b827af8061a4be727f11bd8ad229c51b..513169f3b44911b35440c6a0955d3f621120da53 100644
--- a/MAC/GCF/TM/include/GCF/TM/GCF_Fsm.h
+++ b/MAC/GCF/TM/include/GCF/TM/GCF_Fsm.h
@@ -24,11 +24,9 @@
 #define GCF_FSM_H
 
 #include <MACIO/GCF_Event.h>
-#include <GCF/TM/GCF_Protocols.h>
 #include <GCF/TM/GCF_PortInterface.h>
-
-#include <iostream>
-#include <cstdlib>
+#include <GCF/TM/GCF_Protocols.h>
+#include <GCF/TM/GCF_Scheduler.h>
 
 namespace LOFAR {
   using MACIO::GCFEvent;
@@ -37,63 +35,9 @@ namespace LOFAR {
 
 #define TRAN(_target_) \
   { \
-    tran(static_cast<State>(&_target_), __func__, #_target_); \
+    tran(this, static_cast<State>(&_target_), __func__, #_target_); \
   }
 
-/**
- * This type of port can be used to transport internal messages linked to a 
- * port, which does not implement anything of the typical features of a port
- */
-class GCFDummyPort : public GCFPortInterface
-{
-  public:
-    explicit GCFDummyPort (GCFTask* pTask, 
-                  string name, 
-                  int protocol) : 
-      GCFPortInterface(pTask, name, SPP, protocol, false) 
-    {};
-
-    bool close () {return false;}
-    bool open () {return false;}
-
-    ssize_t send (GCFEvent& /*event*/)
-    {	return (0);	}
-    
-
-    ssize_t recv (void* /*buf*/, 
-                  size_t /*count*/) 
-    {	return (0);	}
-
-    long setTimer (long  /*delay_sec*/,
-                   long  /*delay_usec*/,
-                   long  /*interval_sec*/,
-                   long  /*interval_usec*/,
-                   void* /*arg*/) 
-    {	return (0);	}
-
-    long setTimer (double /*delay_seconds*/, 
-                   double /*interval_seconds*/,
-                   void*  /*arg*/)
-    {	return (0);	}
-
-    int cancelTimer (long /*timerid*/, 
-                     void** /*arg*/) 
-    {	return (0);	}
-
-    int cancelAllTimers ()
-    {	return (0);	}
-
-	double timeLeft(long	/*timerID*/)
-    {	return (0);	}
-  
-  private:
-    // not allowed
-    GCFDummyPort();
-    GCFDummyPort(GCFDummyPort&);
-    GCFDummyPort& operator= (GCFDummyPort&);
-
-};
-
 /**
  * Fsm = Finite State Machine
  * All tasks implement their behaviour in terms of a finite state machine. The 
@@ -116,49 +60,80 @@ class GCFDummyPort : public GCFPortInterface
  */
 class GCFFsm
 {
-  protected: // constructors && destructors
-    typedef MACIO::GCFEvent::TResult (GCFFsm::*State)(GCFEvent& event, GCFPortInterface& port); // ptr to state handler type
+public:
+	// ----- Internal type definitions -----
+	// Define the State function_type.
+    typedef GCFEvent::TResult (GCFFsm::*State)(GCFEvent& event, GCFPortInterface& port); // ptr to state handler type
     
-    explicit  GCFFsm (State initial) : _state(initial) {;} 
-
-  private:
-    GCFFsm();
+    /// let the current State from the adapted task execute the event.
+    GCFEvent::TResult doEvent (GCFEvent& 		 event, 
+							   GCFPortInterface& port)
+    { 
+		if (event.signal == F_TRAN) {
+			GCFTranEvent*	tranEvent((GCFTranEvent*)&event);
+			itsState = tranEvent->state;
+			return (GCFEvent::HANDLED);
+		}
+		return (this->*itsState)(event, port); 
+	}
+
+protected: // constructors && destructors
+	// Define TRANEvent
+	struct GCFTranEvent : public GCFEvent
+	{
+		GCFTranEvent() : GCFEvent(F_TRAN)
+		{
+			length = sizeof(GCFTranEvent);
+		}
+		State 	state;
+	};
+
+    explicit  GCFFsm (State initial) : itsState(initial) {
+		itsScheduler = GCFScheduler::instance();
+	}
 
-  public:
     virtual ~GCFFsm () {;}
   
     /// starts the statemachine with a F_ENTRY signal followed by a F_INIT signal
     void initFsm ();
   
-    /// dispatch incomming signals to the adapted task in the current state
-    MACIO::GCFEvent::TResult dispatch (GCFEvent& event, 
-                                GCFPortInterface& port)
-    {
-      return (this->*_state)(event, port);
-    }
-
 	/// send F_QUIt signal
 	void quitFsm();
   
-  protected:
-  
-    /** state transition; will be used by the MACRO TRAN see above
-     * sends a F_EXIT signal to the current state followed by the state transition
-     * and finaly sends a F_ENTRY signal to the new current state
-     * @param target new state
-     * @param from text of the current state
-     * @param to text of the new state
-     */
-    void tran (State target, 
+    // state transition; will be used by the MACRO TRAN see above
+    // sends a F_EXIT signal to the current state followed by the state transition
+    // and finaly sends a F_ENTRY signal to the new current state
+    // @param target new state
+    // @param from text of the current state
+    // @param to text of the new state
+    void tran (GCFFsm*	task,
+			   State target, 
                const char* from, 
                const char* to);
   
-  protected:
-    volatile State _state;
-  
-  private:
-    static GCFDummyPort _gcfPort;
+	// Allow the scheduler to manipulate my eventQueue.
+	friend class GCFScheduler;
+	void queueTaskEvent(GCFEvent&	event, GCFPortInterface&	port);
+	void handleTaskQueue();
+
+private:
+	// Default construction and copying is not allowed.
+    GCFFsm();
+	GCFFsm(const GCFFsm& that);
+	GCFFsm& operator=(const GCFFsm& that);
+	
+	// ----- DATA MEMBERS -----
+	// Structure for the eventqueue
+	typedef struct {
+		GCFEvent*			event;
+		GCFPortInterface*	port;
+	} waitingTaskEvent_t;
+	list<waitingTaskEvent_t*>	itsEventQueue;
+
+    State 			itsState;
+	GCFScheduler*	itsScheduler;
 };
+
   } // namespace TM
  } // namespace GCF
 } // namespace LOFAR
diff --git a/MAC/GCF/TM/include/GCF/TM/GCF_Handler.h b/MAC/GCF/TM/include/GCF/TM/GCF_Handler.h
index 2c379cf1bbcaeed53d27eb08c2173cc89f72ac59..5cbc4f62ee9f61f07f718c967ff83aca3cbf871c 100644
--- a/MAC/GCF/TM/include/GCF/TM/GCF_Handler.h
+++ b/MAC/GCF/TM/include/GCF/TM/GCF_Handler.h
@@ -26,15 +26,11 @@
 //# Includes
 
 
-namespace LOFAR 
-{
- namespace GCF 
- {
-  namespace TM 
-  {
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
 
 //# forward declaration
-class GCFTask;
 
 /**
   This is the pure abstract (interface) class for all different kind of
@@ -84,7 +80,7 @@ class GCFTask;
 
 class GCFHandler
 {
-  public:
+public:
     /// @return true if no other objects use this handler anymore otherwise false
     bool mayDeleted() { return (_usecount == 0);}
     /// increments the uscount
@@ -92,21 +88,17 @@ class GCFHandler
     /// decrements the uscount
     void leave() { _usecount--;}
   
-  protected:
-    GCFHandler();
-    virtual ~GCFHandler() {;}
-
-    friend class GCFTask;
-
     virtual void workProc () = 0;
     virtual void stop () = 0;
+    virtual ~GCFHandler() {;}
 
-  private:
-    //@{ 
-    /// Don't allow copying this object.
+protected:
+    GCFHandler();
+
+private:
+    // Don't allow copying this object.
     GCFHandler (const GCFHandler&);
     GCFHandler& operator= (const GCFHandler&);  
-    //@}
     
     /// count the usage of this handler    
     unsigned int _usecount;
@@ -116,13 +108,4 @@ class GCFHandler
  } // namespace GCF
 } // namespace LOFAR
 
-
-#include <GCF/TM/GCF_Task.h>
-
-using namespace LOFAR::GCF::TM;
-
-inline GCFHandler::GCFHandler() : _usecount(0) 
-{
-  GCFTask::registerHandler(*this);
-}
 #endif
diff --git a/MAC/GCF/TM/include/GCF/TM/GCF_PortInterface.h b/MAC/GCF/TM/include/GCF/TM/GCF_PortInterface.h
index 89329621a8e2afc568325e543d8b3f661bce7240..68d616d49b356da6a16a7d1106c0a8d0bacc26bc 100644
--- a/MAC/GCF/TM/include/GCF/TM/GCF_PortInterface.h
+++ b/MAC/GCF/TM/include/GCF/TM/GCF_PortInterface.h
@@ -34,6 +34,7 @@
 namespace LOFAR {
  namespace GCF {
   namespace TM {
+	using LOFAR::MACIO::GCFEvent;
 
 // forward declacations
 class GCFTask;
@@ -72,7 +73,7 @@ public:
     /**
     * send/recv functions
     */
-    virtual ssize_t send (LOFAR::MACIO::GCFEvent& event) = 0;
+    virtual ssize_t send (GCFEvent& event) = 0;
     
     virtual ssize_t recv (void* buf, 
                           size_t count) = 0;
@@ -99,6 +100,8 @@ public:
         
 	virtual double	timeLeft(long	timerID) = 0;
 
+    virtual GCFEvent::TResult   dispatch  (GCFEvent& event);
+
     /**
     * Attribute access functions
     */
diff --git a/MAC/GCF/TM/include/GCF/TM/GCF_Protocols.h b/MAC/GCF/TM/include/GCF/TM/GCF_Protocols.h
index f261f5197dd80209d563a084ea7b5da6753752de..75ef02085d808142bf6668edd3bce83f13404f09 100644
--- a/MAC/GCF/TM/include/GCF/TM/GCF_Protocols.h
+++ b/MAC/GCF/TM/include/GCF/TM/GCF_Protocols.h
@@ -53,6 +53,7 @@ enum {
     F_EXIT_ID,      // state exit; currently unused
     F_INIT_ID,      // initial transition
     F_QUIT_ID,      // final run
+	F_TRAN_ID,		// state transition (internal, never send to FSM)
 };
 
 // convenience macros
@@ -60,6 +61,7 @@ enum {
 #define F_EXIT  F_SIGNAL(F_FSM_PROTOCOL, F_EXIT_ID,  F_IN)
 #define F_INIT  F_SIGNAL(F_FSM_PROTOCOL, F_INIT_ID,  F_IN)
 #define F_QUIT  F_SIGNAL(F_FSM_PROTOCOL, F_QUIT_ID,  F_IN)
+#define F_TRAN  F_SIGNAL(F_FSM_PROTOCOL, F_TRAN_ID,  F_IN)
 
 extern const char* F_FSM_PROTOCOL_names[]; 
 extern const struct protocolStrings F_FSM_PROTOCOL_STRINGS; 
diff --git a/MAC/GCF/TM/include/GCF/TM/GCF_RawPort.h b/MAC/GCF/TM/include/GCF/TM/GCF_RawPort.h
index fa609ae5c78fff85158899c336ee86bb779eb5fc..923b0c4481bfc2a18271126bad5e234f740a1e00 100644
--- a/MAC/GCF/TM/include/GCF/TM/GCF_RawPort.h
+++ b/MAC/GCF/TM/include/GCF/TM/GCF_RawPort.h
@@ -26,6 +26,7 @@
 #include <MACIO/GCF_Event.h>
 #include <GCF/TM/GCF_PortInterface.h>
 #include <GCF/TM/GCF_Task.h>
+#include <GCF/TM/GCF_Scheduler.h>
 #include <Common/lofar_string.h>
 #include <Common/lofar_map.h>
 
@@ -92,6 +93,7 @@ public:
 
 	virtual double	timeLeft(long	timerID);
 
+    virtual GCFEvent::TResult   dispatch(GCFEvent& event);
 protected: 
 	// constructors && destructors
     /// params see constructor of GCFPortInterface
@@ -113,17 +115,26 @@ protected:
     
 	// helper methods
     friend class GCFPort; // to access the setMaster method
-    friend class GTMTimer;
-    friend class GTMFile;
-
-    void schedule_disconnected();
-    void schedule_close();
-    void schedule_connected();
+//    friend class GTMTimer;//
+//    friend class GTMFile; // they all call dispatch
+//    friend class GCFTask; //
+
+    void schedule_disconnected() {
+		GCFEvent	event(F_DISCONNECTED);
+		GCFScheduler::instance()->queueEvent(0, event, this);
+	}
+    void schedule_close() {
+		GCFEvent	event(F_CLOSED);
+		GCFScheduler::instance()->queueEvent(0, event, this);
+	}
+    void schedule_connected() {
+		GCFEvent	event(F_CONNECTED);
+		GCFScheduler::instance()->queueEvent(0, event, this);
+	}
 
     bool                        isSlave () const {return _pMaster != 0;}
     virtual void                setMaster (GCFPort* pMaster) {_pMaster = pMaster;}
 
-    virtual GCFEvent::TResult   dispatch (GCFEvent& event);
     GCFEvent::TResult           recvEvent();
 
     bool                        findAddr (TPeerAddr& addr);
@@ -131,7 +142,10 @@ protected:
     /// returns the original name of the port (given by the user). 
     /// in case it is a slave port an extension is append to the original name 
     string		                getRealName() const;  
-  
+
+	// admin. data member
+    GTMTimerHandler*            _pTimerHandler;
+
 private: 
     /// copying is not allowed.
     GCFRawPort (const GCFRawPort&);
@@ -140,8 +154,8 @@ private:
 	// data member
     GCFPort* 					_pMaster;
 
-	// admin. data member
-    GTMTimerHandler*            _pTimerHandler;
+	// Pointer to scheduler
+	GCFScheduler*				itsScheduler;
 };
   } // namespace TM
  } // namespace GCF
diff --git a/MAC/GCF/TM/include/GCF/TM/GCF_Scheduler.h b/MAC/GCF/TM/include/GCF/TM/GCF_Scheduler.h
new file mode 100644
index 0000000000000000000000000000000000000000..bbb6ea2c6dc97aabe4885d6debe8b7b2b5896826
--- /dev/null
+++ b/MAC/GCF/TM/include/GCF/TM/GCF_Scheduler.h
@@ -0,0 +1,228 @@
+//#  GCF_Scheduler.h: handles all events for a task.
+//#
+//#  Copyright (C) 2002-2003
+//#  ASTRON (Netherlands Foundation for Research in Astronomy)
+//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//#  This program 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.
+//#
+//#  This program 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 this program; if not, write to the Free Software
+//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//#  $Id$
+
+#ifndef GCF_SCHEDULER_H
+#define GCF_SCHEDULER_H
+
+#include <Common/lofar_list.h>
+#include <Common/lofar_map.h>
+#include <MACIO/GCF_Event.h>
+#include <GCF/TM/GCF_PortInterface.h>
+
+namespace LOFAR {
+  using MACIO::GCFEvent;
+  namespace GCF {
+    namespace TM {
+
+// forward declaration
+class GCFPort;
+class GCFHandler;
+class GCFFsm;
+
+// This type of port can be used to transport internal messages linked to a 
+// port, which does not implement anything of the typical features of a port
+class GCFDummyPort : public GCFPortInterface
+{
+public:
+	GCFDummyPort (GCFTask* pTask, string name, int protocol) : 
+		GCFPortInterface(pTask, name, SPP, protocol, false) 
+	{}
+
+	// Since we inherit from ABC GCFPortInterface we must 'implement' all functions.
+	bool close () 								  { return (false); }
+	bool open () 								  { return (false); }
+	ssize_t send (GCFEvent&) 					  { return (0);	}
+	ssize_t recv (void*, size_t) 				  { return (0);	}
+	long setTimer (long, long, long, long, void*) {	return (0);	}
+	long setTimer (double, double, void*)		  { return (0);	}
+	int  cancelTimer (long, void**)				  { return (0);	}
+	int  cancelAllTimers ()						  { return (0);	} 
+	double timeLeft(long)						  { return (0);	}
+
+private:
+	// not allowed
+	GCFDummyPort();
+	GCFDummyPort(GCFDummyPort&);
+    GCFDummyPort& operator= (GCFDummyPort&);
+};
+
+// This is the base class for all tasks in an application. Different 
+// specialisations of this class results in a number of concurrent finite state 
+// machines with own ports to other tasks (in other processes). 
+// Note: This is not a representation of a 'thread' related to the 
+// multithreading concept.
+class GCFScheduler
+{
+public:  
+	// Construction via singleton mechanism
+	static GCFScheduler*	instance();
+    
+    // Inits a number of services for the GCF based application:
+    // - holds the argc and argv parameters in static data members
+    // - lofar logger(argv[0].log_prop or "mac.log_prop")
+    // - parameterset(argv[0] + ".conf")
+    void init (int argc, char** argv, const string&	logfile = "");
+    
+    // The run method. This starts the event processing loop.
+    // When multiple tasks are declared within the same binary, only
+    // one call to GCFScheduler::run will suffice.
+    // A call to this function will NEVER return (except on stop). 
+    //
+    // @code
+    //     class MyTask : public GCFTask { ... }
+    //
+    //     int main(int argc, char** argv)
+    //     {
+    //         // create two tasks, a and b.
+	//         GCFScheduler*	theSched = GCFScheduler::instance();
+    //         theSched.init(argc, argv);
+    // 
+    //         MyTask a("a");
+    //         MyTask b("b");
+    //         a.start();
+    //         b.start();
+    //         // start the event processing loop
+    //         theSched->run();
+    //     }
+    // 
+    // @endcode
+    //
+	// The method described above has one major drawback: When one task calls 
+	// stop() the others tasks are also immediately stopped. They done get a 
+	// change to stop their actions in a neat way.
+	// In Nov. 2007 the F_QUIT signal was introduced that solves this problem.
+	// When stop is called each task can receive a F_QUIT signal allowing the
+	// task to do its closing actions.
+	// The main loop has to be changed into:
+	//
+	// @code
+    //     class MyTask : public GCFTask { ... }
+    //
+    //     int main(int argc, char** argv)
+    //     {
+    //         // create two tasks, a and b.
+	//         GCFScheduler*	theSched = GCFScheduler::instance();
+    //         theSched.init(argc, argv);
+    // 
+    //         MyTask a("a");
+    //         MyTask b("b");
+    //         a.start();
+    //         b.start();
+	//
+	//		   theSched->setDelayedQuit(true);		// <--
+    //         // start the event processing loop
+    //         theSched->run();
+	//
+	//		   // when stop() was called we continue here
+	//		   a.quit();			// send the F_QUIT signals
+	//		   b.quit();
+	//		   theSched->run(2);	// let it run for another 2 seconds
+    //     }
+    // 
+    // @endcode
+    void run (double	seconds = 0.0);
+    
+    // registers a GCFHandler for the mainloop
+    void registerHandler (GCFHandler& handler);
+    
+    // deregisters a GCFHandler from the mainloop
+    void deregisterHandler (GCFHandler& handler);
+
+    // stops the application; it stops all registered handlers
+    void stop () {  itsDoExit = true; }
+
+	// specificy whether or not F_QUIT signals are send after stop
+	// to allow the tasks to do their final run.
+	void setDelayedQuit(bool	newState) { itsDelayedQuit = newState; }
+ 
+	//  data members
+    //	the command line arguments passed to the application at start-up
+    //	they are set by means of the static init method
+    //    
+    static int _argc;
+    static char** _argv;
+   
+	void queueEvent(GCFFsm*	task, GCFEvent&	event, GCFPortInterface* port);
+	void printEventQueue();
+	void disableQueue() { itsUseQueue = false; }
+
+private:
+	void _addEvent (GCFFsm*	task, GCFEvent&	event, GCFPortInterface* port, GCFEvent::TResult status);
+	GCFEvent::TResult  _sendEvent(GCFFsm* task, GCFEvent& event, GCFPortInterface* port);
+
+    // Singleton
+    GCFScheduler();
+	GCFScheduler(const GCFScheduler&	that);
+	GCFScheduler& operator=(const GCFScheduler& that);
+	~GCFScheduler();
+
+    // handles system signals
+    static void signalHandler(int sig);
+
+	// give a stop signal to all the handlers
+	void stopHandlers();
+
+	void handleEventQueue();
+
+	// --- DATA MEMBERS ---
+	// Structure for the eventqueue
+	typedef struct {
+		GCFEvent*			event;
+		GCFPortInterface*	port;
+		GCFFsm*				task;
+		int					handlingType;
+		int					seqNr;
+	} waitingEvent_t;
+	list<waitingEvent_t*>	theEventQueue;
+
+    // all registered handlers, which should be invoked (workProc) circulair
+    typedef map<GCFHandler*, bool /*valid*/> HandlerMap_t;
+    HandlerMap_t	itsHandlers;
+    HandlerMap_t 	itsTempHandlers;
+
+    /// all registered protocols in the application
+    typedef map<unsigned short, const char**> ProtocolMap_t;
+    ProtocolMap_t	itsProtocols;
+
+    /// indicates wether the application should be stopped or not
+    bool	itsDoExit;
+
+	// Indicates if the tasks will stop immediately after the stop command or
+	// if the will receive a final F_QUIT signal.
+	bool	itsDelayedQuit;
+
+	// whether or not Scheduler was initiated.
+	bool	itsIsInitialized;
+
+	bool	itsUseQueue;
+
+	// Dummy port to be passed in event we make.
+    GCFDummyPort*			itsFrameworkPort;
+
+	static GCFScheduler*	theirGCFScheduler;
+};
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
+
+#endif
diff --git a/MAC/GCF/TM/include/GCF/TM/GCF_TCPPort.h b/MAC/GCF/TM/include/GCF/TM/GCF_TCPPort.h
index 605a65847b770c8865e13c49e5d3ad124aeac602..274084166514403f3e03dc4612835a4429a4902d 100644
--- a/MAC/GCF/TM/include/GCF/TM/GCF_TCPPort.h
+++ b/MAC/GCF/TM/include/GCF/TM/GCF_TCPPort.h
@@ -65,53 +65,63 @@ public:// consturctors && destructors
      */ 
     GCFTCPPort ();
   
-private:  
-    /// copying is not allowed.
-    GCFTCPPort (const GCFTCPPort&);
-    GCFTCPPort& operator= (const GCFTCPPort&);
-
-public:
-    /// desctructor
+    /// destructor
     virtual ~GCFTCPPort ();
   
-public: // GCFPortInterface overloaded/defined methods
+	// GCFPortInterface overloaded/defined methods
     void init (GCFTask& 	 task, 
                const string& name, 
                TPortType 	 type, 
                int 			 protocol, 
                bool 		 transportRawData = false); 
 
-    /**
-     * open/close methods
-     */
+    // open/close methods
     virtual bool open ();
     virtual bool close ();
       
-    /**
-     * send/recv functions
-     */
+    // send/recv functions
     virtual ssize_t send (GCFEvent& event);
     virtual ssize_t recv (void* buf,
                           size_t count);
-public: // GCFTCPPort specific methods    
+
+	// Special auto-open mode that does the retries itself
+	// nrRetries		: -1 = infinite ; How often to retry the open when it fails.
+	// reconnectInterval: After how many seconds after a fail a reconnect attempt will be made.
+	// timeout  		: -1 = infinite ; How long the auto-open attempts may last.
+	//
+	// Note: autoOpen(0,0) acts the same as open()
+	// When both nrRetries and timeout are specified the condition that will be met first will stop the auto open sequence.
+	void autoOpen(uint	nrRetries=5, double	timeout=-1.0, double	reconnectInterval=10.0);
+	virtual GCFEvent::TResult	dispatch(GCFEvent&	event);		// need to overright this one for autoOpen
+
+	// GCFTCPPort specific methods    
     virtual bool accept (GCFTCPPort& port); 
     // addr is local address if getType == (M)SPP
     // addr is remote addres if getType == SAP
-    void setAddr (const TPeerAddr& addr);
-    void setHostName(const string& hostname);
+    void setAddr 	  (const TPeerAddr& addr);
+    void setHostName  (const string& hostname);
     void setPortNumber(unsigned int portNumber);
     string getHostName();
     unsigned int getPortNumber();
 
-private: // helper methods
+private:  
+    /// copying is not allowed.
+    GCFTCPPort (const GCFTCPPort&);
+    GCFTCPPort& operator= (const GCFTCPPort&);
+
+	// helper methods
     friend class SB::ServiceBrokerTask;
     void serviceRegistered(unsigned int result, unsigned int portNumber);
     void serviceUnregistered();
     void serviceInfo(unsigned int result, unsigned int portNumber, const string& host);
     void serviceGone();
+
+	void _handleConnect();
+	void _handleDisconnect();
     
-protected: // data members
-    GTMTCPSocket*   _pSocket;
+	// ----- Data Members -----
+protected: 
+    GTMTCPSocket*   		_pSocket;
 
 private:
     bool					_addrIsSet;
@@ -119,9 +129,15 @@ private:
     string					_host;
     unsigned int			_portNumber;
 	bool					itsFixedPortNr;
+	bool					itsAutoOpen;
+	unsigned int			itsAutoOpenTimer;
+	unsigned int			itsAutoRetryTimer;
+	int						itsAutoRetries;
+	double					itsAutoRetryItv;
     SB::ServiceBrokerTask*	_broker;
 };
 
+
 inline void GCFTCPPort::setHostName(const string& hostname)
 {
 	// assure that hostname is never filled with localname.
@@ -141,12 +157,12 @@ inline void GCFTCPPort::setPortNumber(unsigned int portNumber)
 
 inline string GCFTCPPort::getHostName()
 {
-  return _host;
+	return _host;
 }
 
 inline unsigned int GCFTCPPort::getPortNumber()
 {
-  return _portNumber;
+	return _portNumber;
 }
   } // namespace TM
  } // namespace GCF
diff --git a/MAC/GCF/TM/include/GCF/TM/GCF_Task.h b/MAC/GCF/TM/include/GCF/TM/GCF_Task.h
index 208de542ec4cffc79264260d92694fba8e5777a0..647a16a80a0582eaf90c5b423d6dbc8aeab9ab3a 100644
--- a/MAC/GCF/TM/include/GCF/TM/GCF_Task.h
+++ b/MAC/GCF/TM/include/GCF/TM/GCF_Task.h
@@ -23,6 +23,7 @@
 #ifndef GCF_TASK_H
 #define GCF_TASK_H
 
+#include <Common/lofar_list.h>
 #include <Common/lofar_map.h>
 #include <GCF/TM/GCF_Fsm.h>
 
@@ -31,8 +32,6 @@ namespace LOFAR {
     namespace TM {
 
 // forward declaration
-class GCFPort;
-class GCFHandler;
 
 /**
  * This is the base class for all tasks in an application. Different 
@@ -46,7 +45,7 @@ class GCFTask : public GCFFsm
 {
 public:  
 	// constuctors
-    virtual ~GCFTask();
+    virtual ~GCFTask() { }
 
     // "starts" this task; see code example from run method
     void start () { initFsm(); }
@@ -54,135 +53,24 @@ public:
 	// Gives task a final change to end their actions
 	void quit () { quitFsm();	}
     
-    // -- static method --
-    // Inits a number of services for the GCF based application:
-    // - holds the argc and argv parameters in static data members
-    // - lofar logger(argv[0].log_prop or "mac.log_prop")
-    // - parameterset(argv[0] + ".conf")
-    //     
-    static void init (int argc, char** argv, const string&	logfile = "");
-    
-    // The static run method. This starts the event processing loop.
-    // When multiple tasks are declared within the same binary, only
-    // one call to GCFTask::run will suffice.
-    // A call to this function will NEVER return (except on stop). 
-    //
-    // @code
-    //     class MyTask : public GCFTask { ... }
-    //
-    //     int main(int argc, char** argv)
-    //     {
-    //         // create two tasks, a and b.
-    //         GCFTask::init(argc, argv);
-    // 
-    //         MyTask a("a");
-    //         MyTask b("b");
-    //         a.start();
-    //         b.start();
-    //         // start the event processing loop
-    //         GCFTask::run();
-    //     }
-    // 
-    // @endcode
-    //
-	// The method described above has one major drawback: When one task calls 
-	// stop() the others tasks are also immediately stopped. They done get a 
-	// change to stop their actions in a neat way.
-	// In Nov. 2007 the F_QUIT signal was introduced that solves this problem.
-	// When stop is called each task can receive a F_QUIT signal allowing the
-	// task to do its closing actions.
-	// The main loop has to be changed into:
-	//
-	// @code
-    //     class MyTask : public GCFTask { ... }
-    //
-    //     int main(int argc, char** argv)
-    //     {
-    //         // create two tasks, a and b.
-    //         GCFTask::init(argc, argv);
-    // 
-    //         MyTask a("a");
-    //         MyTask b("b");
-    //         a.start();
-    //         b.start();
-	//		   GCFTask::setDelayedQuit(true);		// <--
-	//
-    //         // start the event processing loop
-    //         GCFTask::run();
-	//
-	//		   // when stop() was called we continue here
-	//		   a.quit();		// send the F_QUIT signals
-	//		   b.quit();
-	//		   GCFTask::run(2);	// let it run for another 2 seconds
-    //     }
-    // 
-    // @endcode
-
-
-    static void run (double	seconds = 0.0);
-    
-    // registers a GCFHandler for the mainloop
-    static void registerHandler (GCFHandler& handler);
-    
-    // deregisters a GCFHandler from the mainloop
-    static void deregisterHandler (GCFHandler& handler);
-
-    // stops the application; it stops all registered handlers
-    static void stop () {  _doExit = true; }
-
-	// specificy whether or not F_QUIT signals are send after stop
-	// to allow the tasks to do their final run.
-	static void setDelayedQuit(bool	newState) { _delayedQuit = newState; }
- 
     // Get the name of the task.
     const string& getName () const {return _name;}
     // Set the name of the task.
     void setName (string& name) {_name = name;}
 
-	//  data members
-    //	the command line arguments passed to the application at start-up
-    //	they are set by means of the static init method
-    //    
-    static int _argc;
-    static char** _argv;
-   
 protected:
-    explicit GCFTask (State initial, 
-                      const string& name); 
+    explicit GCFTask (State initial, const string& name) :
+		GCFFsm(initial), _name(name) { }
 
 private:
-    friend class GCFPort;
-    friend class GCFRawPort;
-
     // Is private to avoid initialising a task without giving an inital state and the task name
     GCFTask();
   
-    // handles system signals
-    static void signalHandler(int sig);
-
-	// give a stop signal to all the handlers
-	static void stopHandlers();
-
 	// --- DATA MEMBERS ---
     // the task name
     string _name;
-    // all registered handlers, which should be invoked (workProc) circulair
-    typedef map<GCFHandler*, bool /*valid*/> THandlers;
-    static THandlers _handlers;
-    static THandlers _tempHandlers;
-
-    /// all registered protocols in the application
-    typedef map<unsigned short, const char**> TProtocols;
-    static TProtocols _protocols;
-
-    /// indicates wether the application should be stopped or not
-    static bool _doExit;
-
-	// Indicates if the tasks will stop immediately after the stop command or
-	// if the will receive a final F_QUIT signal.
-	static bool _delayedQuit;
-
 };  
+
   } // namespace TM
  } // namespace GCF
 } // namespace LOFAR
diff --git a/MAC/GCF/TM/include/GCF/TM/Makefile.am b/MAC/GCF/TM/include/GCF/TM/Makefile.am
index 360d4adea890968ef90cc4c8522e64bcab3baaac..56eac1648e47d5a99d04f8afe2494d01f5ed876d 100644
--- a/MAC/GCF/TM/include/GCF/TM/Makefile.am
+++ b/MAC/GCF/TM/include/GCF/TM/Makefile.am
@@ -1,6 +1,7 @@
 pkgincludedir = $(includedir)/GCF/TM
 pkginclude_HEADERS = Package__Version.h  \
 	GCF_Control.h \
+	GCF_Scheduler.h \
 	GCF_DevicePort.h \
 	GCF_ETHRawPort.h \
 	GCF_Fsm.h \
diff --git a/MAC/GCF/TM/src/GCF_Fsm.cc b/MAC/GCF/TM/src/GCF_Fsm.cc
index 12925989d43a9a4c0054c2c5fc59f49a93142fc8..2153b31437e78435e98ad87cd113733a7e0dc35b 100644
--- a/MAC/GCF/TM/src/GCF_Fsm.cc
+++ b/MAC/GCF/TM/src/GCF_Fsm.cc
@@ -25,47 +25,39 @@
 #include <Common/LofarLogger.h>
 #include <Common/StringUtil.h>
 #include <GCF/TM/GCF_Fsm.h>
-#include <GTM_Defines.h>
 
 namespace LOFAR {
  using MACIO::GCFEvent;
  namespace GCF {
   namespace TM {
 
-// static data member initialisation
-GCFDummyPort GCFFsm::_gcfPort(0, "GCFFSM", F_FSM_PROTOCOL);
-
 //
 // initFsm()
 //
 void GCFFsm::initFsm()
 {
-	GCFEvent e;
-	e.signal = F_ENTRY;
-	(void)(this->*_state)(e, _gcfPort); // entry signal
-	e.signal = F_INIT;
-	if (GCFEvent::HANDLED != (this->*_state)(e, _gcfPort)) { // initial transition
-		LOG_FATAL(LOFAR::formatString (
-			"Fsm::init: initial transition F_SIGNAL(F_FSM_PROTOCOL, F_INIT) not handled."));
-		exit(1);
-	}
+	GCFEvent	entryEvent(F_ENTRY);
+	itsScheduler->queueEvent(this, entryEvent, 0);
+
+	GCFEvent	initEvent(F_INIT);
+	itsScheduler->queueEvent(this, initEvent, 0);
 }
 
 //
 // tran(target, from, to)
 //
-void GCFFsm::tran(State target, const char* from, const char* to)
+void GCFFsm::tran(GCFFsm*	task, State target, const char* from, const char* to)
 {
-	GCFEvent e;
-	e.signal = F_EXIT;
-	(void)(this->*_state)(e, _gcfPort); // exit signal
+	GCFEvent	exitEvent(F_EXIT);
+	itsScheduler->queueEvent(this, exitEvent, 0);
 
 	LOG_DEBUG(LOFAR::formatString ( "State transition to %s <<== %s", to, from));
+	GCFTranEvent	tranEvent;
+	tranEvent.state = target;
+	itsScheduler->queueEvent(this, tranEvent, 0);
 
-	_state = target; // state transition
-
-	e.signal = F_ENTRY;
-	(void)(this->*_state)(e, _gcfPort); // entry signal
+	GCFEvent	entryEvent(F_ENTRY);
+	itsScheduler->queueEvent(this, entryEvent, 0);
 }
 
 //
@@ -73,9 +65,45 @@ void GCFFsm::tran(State target, const char* from, const char* to)
 //
 void GCFFsm::quitFsm()
 {
-	GCFEvent	event;
-	event.signal = F_QUIT;
-	(void)(this->*_state)(event, _gcfPort);
+	GCFEvent	quitEvent(F_QUIT);
+	itsScheduler->queueEvent(this, quitEvent, 0);
+}
+
+//
+// queueTaskEvent(event,port)
+//
+// Add the given event/port pair to the eventqueue of the task. This queue is emptied as soon as the
+// state of the task is switched.
+//
+void GCFFsm::queueTaskEvent(GCFEvent&	event, GCFPortInterface&	port)
+{
+	waitingTaskEvent_t*		newEntry = new waitingTaskEvent_t;
+	newEntry->event = &event;
+	newEntry->port  = &port;
+	itsEventQueue.push_back(newEntry);
+}
+
+//
+// handleTaskQueue()
+//
+// Send all the events in the task queue ONCE to the task. If the task does not handle them log this
+// problem and continue.
+//
+void GCFFsm::handleTaskQueue()
+{
+	while (!itsEventQueue.empty()) {
+		waitingTaskEvent_t*		theEvent = itsEventQueue.front();
+		LOG_DEBUG_STR("handleTaskQueue:(" << eventName(*(theEvent->event)) << "@" << theEvent->port->getName() << ")");
+		
+		GCFEvent::TResult result = (this->*itsState)(*(theEvent->event), *(theEvent->port));
+		if (result != GCFEvent::HANDLED) {
+			LOG_WARN_STR("Result on taskEvent " << eventName(*(theEvent->event)) << 
+						  " was NOT HANDLED, DELETING event.");
+		}
+		itsEventQueue.pop_front();
+		delete theEvent->event;
+		delete theEvent;
+	}
 }
 
   } // namespace TM
diff --git a/MAC/GCF/TM/src/GCF_Handler.cc b/MAC/GCF/TM/src/GCF_Handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9896cc8a695fd33b70f35407c7f6339badd5d3bf
--- /dev/null
+++ b/MAC/GCF/TM/src/GCF_Handler.cc
@@ -0,0 +1,39 @@
+//#  GCF_Handler.cc: generic handler class
+//#
+//#  Copyright (C) 2002-2009
+//#  ASTRON (Netherlands Foundation for Research in Astronomy)
+//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//#  This program 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.
+//#
+//#  This program 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 this program; if not, write to the Free Software
+//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//#  $Id$
+
+#include <lofar_config.h>
+#include <GCF/TM/GCF_Handler.h>
+#include <GCF/TM/GCF_Scheduler.h>
+
+namespace LOFAR {
+  namespace GCF {
+    namespace TM {
+
+GCFHandler::GCFHandler() : 
+	_usecount(0) 
+{
+	GCFScheduler::instance()->registerHandler(*this);
+}
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
diff --git a/MAC/GCF/TM/src/GCF_Protocols.cc b/MAC/GCF/TM/src/GCF_Protocols.cc
index 4ff7bbaf42ca02d92874905d57e208c3b22b386a..18b8710d2c35e8f8a0226cb4ee6de5e0fc4fadb9 100644
--- a/MAC/GCF/TM/src/GCF_Protocols.cc
+++ b/MAC/GCF/TM/src/GCF_Protocols.cc
@@ -43,7 +43,8 @@ const char* F_FSM_PROTOCOL_names[] =
   "F_ENTRY",
   "F_EXIT",
   "F_INIT",
-  "F_QUIT"
+  "F_QUIT",
+  "F_TRAN"
 };
 
 //
@@ -64,7 +65,7 @@ const char* F_PORT_PROTOCOL_names[] =
 };
 
 const struct protocolStrings F_FSM_PROTOCOL_STRINGS = {
-	5, 0, F_FSM_PROTOCOL_names, 0
+	6, 0, F_FSM_PROTOCOL_names, 0
 };
 
 const struct protocolStrings F_PORT_PROTOCOL_STRINGS = {
diff --git a/MAC/GCF/TM/src/GCF_Scheduler.cc b/MAC/GCF/TM/src/GCF_Scheduler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6413f295d0e0b7e5140d35d983e82c26fe5cc76b
--- /dev/null
+++ b/MAC/GCF/TM/src/GCF_Scheduler.cc
@@ -0,0 +1,420 @@
+//#  GCF_Task.cc: task class which encapsulates a task and its behaviour as a 
+//#  finite state machine (FSM).
+//#
+//#  Copyright (C) 2002-2003
+//#  ASTRON (Netherlands Foundation for Research in Astronomy)
+//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//#
+//#  This program 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.
+//#
+//#  This program 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 this program; if not, write to the Free Software
+//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//#
+//#  $Id$
+
+#include <lofar_config.h>
+#include <Common/LofarLogger.h>
+#include <Common/lofar_fstream.h>
+#include <Common/LofarLocators.h>
+#include <Common/ParameterSet.h>
+#include <Common/hexdump.h>
+
+#include <GCF/TM/GCF_PortInterface.h>
+#include <GCF/TM/GCF_Protocols.h>
+#include <GCF/TM/GCF_Handler.h>
+#include <GCF/TM/GCF_Task.h>
+#include <GCF/TM/GCF_Scheduler.h>
+
+#include <signal.h>
+#include <sys/time.h>
+
+namespace LOFAR {
+  namespace GCF {
+    namespace TM {
+
+// static member initialisation
+GCFScheduler*		GCFScheduler::theirGCFScheduler = 0;
+int 				GCFScheduler::_argc = 0;
+char** 				GCFScheduler::_argv = 0;
+
+//
+// instance()
+//
+GCFScheduler*	GCFScheduler::instance()
+{
+	if (theirGCFScheduler == 0) {
+		theirGCFScheduler = new GCFScheduler();
+	}
+	return (theirGCFScheduler);
+}
+
+//
+// Default construction
+//
+GCFScheduler::GCFScheduler() :
+	itsDoExit		(false),
+	itsDelayedQuit	(false),
+	itsIsInitialized(false),
+	itsUseQueue		(true),
+	itsFrameworkPort(0)
+{
+	cout << "Creation of GCFScheduler" << endl;
+ 	itsFrameworkPort = new GCFDummyPort(0, "FrameWork", F_FSM_PROTOCOL);
+	ASSERTSTR(itsFrameworkPort, "Cannot construct a port for the framework");
+}
+
+//
+// ~GCFScheduler()
+//
+GCFScheduler::~GCFScheduler()
+{
+	delete itsFrameworkPort;
+
+	// clear the maps
+}
+
+//
+// init(argc, argv, logfile)
+//
+void GCFScheduler::init(int argc, char** argv, const string&	logfile)
+{
+	ASSERTSTR(!itsIsInitialized, "Attempt to initialized the GCFScheduler twice");
+
+	_argc = argc;
+	_argv = argv;
+
+	// Try to open the log_prop file, if process has its own log_prop file then use it
+	// the INIT_LOGGER otherwise use the default mac.log_prop
+	ConfigLocator	aCL;
+	string 			procName(basename(argv[0]));
+	string			logPropFile(procName + ".log_prop");
+	// First try logpropfile <task>.log_prop
+	if (aCL.locate(logPropFile) == "") {
+		// locator could not find it try defaultname
+		logPropFile = "mac.log_prop";
+	}
+
+	if (logfile.empty()) {
+		INIT_LOGGER(aCL.locate(logPropFile).c_str());
+		LOG_INFO_STR ("Initialized logsystem with: " << aCL.locate(logPropFile));
+	}
+	else {
+		INIT_VAR_LOGGER(aCL.locate(logPropFile).c_str(), logfile);
+		LOG_INFO_STR ("Initialized logsystem with: " << aCL.locate(logPropFile) <<
+						"," << logfile);
+	}
+
+	// Read in the ParameterSet of the task (<task>.conf)
+	ParameterSet*	pParamSet = globalParameterSet();
+	string			configFile(aCL.locate(procName + ".conf"));
+	if (!configFile.empty()) {
+		LOG_INFO_STR ("Using parameterfile: " << configFile);
+		pParamSet->adoptFile(configFile);
+	}
+	else {
+		LOG_INFO_STR ("NO DEFAULT PARAMETERSET FOUND");
+	}
+
+	registerProtocol(F_FSM_PROTOCOL, F_FSM_PROTOCOL_STRINGS);
+	registerProtocol(F_PORT_PROTOCOL,F_PORT_PROTOCOL_STRINGS);
+
+	itsIsInitialized = true;
+}
+
+//
+// run(secondsToRun)
+//
+void GCFScheduler::run(double maxSecondsToRun)
+{
+	// catch terminate signals
+	signal(SIGINT,  GCFScheduler::signalHandler);
+	signal(SIGTERM, GCFScheduler::signalHandler);
+	signal(SIGPIPE, SIG_IGN);
+
+	double	terminateTime(0.0);
+	struct timeval	TV;
+	if (maxSecondsToRun) {
+		LOG_INFO_STR("Program execution stops over " << maxSecondsToRun << " seconds");
+		gettimeofday(&TV, 0);
+		terminateTime = TV.tv_sec + (TV.tv_usec / 10000000) + maxSecondsToRun;
+	}
+
+	LOG_DEBUG("Entering main loop of GCFScheduler");
+
+	// always start with emptying the already queued events
+	handleEventQueue();
+
+	// THE MAIN LOOP OF THE MAC PROCESS
+	// can only be interrupted/stopped by calling stop or terminating the application
+	while (!itsDoExit) {
+		// new handlers can be add during processing the workProc
+		// thus a temp handler map is used
+		itsTempHandlers.clear();
+		itsTempHandlers.insert(itsHandlers.begin(), itsHandlers.end()); 
+//		LOG_DEBUG_STR("Nr of handlers: " << itsHandlers.size());
+		for (HandlerMap_t::iterator iter = itsTempHandlers.begin() ; 
+								iter != itsTempHandlers.end() && !itsDoExit; ++iter) {
+			if (iter->second) {
+				iter->first->workProc();
+				handleEventQueue();
+			}
+		} // for
+
+		// time to quit?
+		if (maxSecondsToRun) {
+			gettimeofday(&TV, 0);
+			if ((TV.tv_sec + (TV.tv_usec / 10000000)) >= terminateTime) {
+				itsDoExit = true;
+			}
+		}
+	} // while
+
+	if (!itsDelayedQuit) {
+		stopHandlers();
+	}
+	else {
+		itsDelayedQuit = false;	// never delay twice
+		itsDoExit = false;		// we will run again
+	}
+}
+
+//
+// stopHandlers()
+//
+// An application can be stopped in two ways, a task itself may call stop() or
+// the user may kill the program.
+//
+void GCFScheduler::stopHandlers()
+{
+	for (HandlerMap_t::iterator iter = itsHandlers.begin() ; iter != itsHandlers.end() ; ++iter) {
+		if (iter->second)  {	// if pointer is still valid
+			iter->first->stop();	// give handler a way of stopping in a neat way
+		}
+	} 
+
+	// STEP 2
+	LOG_INFO("Process is stopped! Possible reasons: 'stop' called or terminated");
+	GCFHandler* pHandler(0);
+	for (HandlerMap_t::iterator iter = itsHandlers.begin() ; iter != itsHandlers.end(); ++iter) {
+		if (!iter->second)  {
+			continue; // handler pointer is not valid anymore, 
+		}
+		// because this handler was deleted by the user
+		pHandler = iter->first;
+		pHandler->leave(); // "process" is also a handler user, see registerHandler
+		if (pHandler->mayDeleted())  { // no other object uses this handler anymore?
+			delete pHandler;
+		}
+	} 
+
+	itsHandlers.clear();
+}
+
+//
+// registerHandler(handler)
+//
+// NOTE: There are only a few handlers defined, timerHandler, fileHandler, PVSS Handler.
+//	Those handlers handle the work of all 'ports' of that type. E.g. the timerHandler handles
+// 	the decrement of all timers defined in all tasks!!!!
+//
+void GCFScheduler::registerHandler(GCFHandler& handler)
+{
+	LOG_TRACE_OBJ("GCFScheduler::registerHandler");
+	itsHandlers[&handler] = true; // valid pointer
+	handler.use(); // released after stop
+}
+
+//
+// deregisterHandler(handler)
+//
+void GCFScheduler::deregisterHandler(GCFHandler& handler)
+{
+	LOG_TRACE_OBJ("GCFScheduler::deregisterHandler");
+	HandlerMap_t::iterator iter = itsTempHandlers.find(&handler);
+	if (iter != itsTempHandlers.end()) {
+		iter->second = false; 	// pointer will be made invalid because the user 
+								// deletes the handler by itself                          
+	}
+	itsHandlers.erase(&handler);
+}
+
+//
+// _sendEvent
+//
+GCFEvent::TResult GCFScheduler::_sendEvent(GCFFsm* task, GCFEvent& event, GCFPortInterface*    port)
+{
+	if (task) {
+		return (task->doEvent(event, port ? *port : *itsFrameworkPort));
+	}
+	return(port->dispatch(event));
+}
+
+//
+// queueEvent
+//
+void GCFScheduler::queueEvent(GCFFsm* task, GCFEvent& event, GCFPortInterface*    port)
+{
+	if (!itsUseQueue) {
+		_sendEvent(task, event, port);
+		return;
+	}
+
+	// Framework events are always queued,
+	if (F_EVT_PROTOCOL(event) == F_FSM_PROTOCOL || F_EVT_PROTOCOL(event) == F_PORT_PROTOCOL) {
+		_addEvent(task, event, port, GCFEvent::NOT_HANDLED);
+		return;
+	}
+
+	// Events not generated by the framework are send immediately to the task to avoid copying.
+	GCFEvent::TResult	status;
+	if ((status = _sendEvent(task, event, port)) == GCFEvent::HANDLED) {
+		return;	// its handled, we saved ourselves a copy.
+	}
+
+	switch (status) {
+	case GCFEvent::NOT_HANDLED:
+		LOG_TRACE_COND_STR("IGNORING event " << eventName(event) << 
+					  " because return status is NOT_HANDLED");
+		break;
+
+	case GCFEvent::NEXT_STATE:
+		LOG_TRACE_COND("Moving event to eventQ of task, waiting there for state switch");
+		task->queueTaskEvent(*(event.clone()), *port);
+		break;
+	} // switch
+}
+
+//
+// _addEvent(task, event, port)
+//
+// Should only be called direct after an (external) event was received at a port.
+//
+void GCFScheduler::_addEvent(GCFFsm*			task, GCFEvent&			event, 
+							 GCFPortInterface*	port, GCFEvent::TResult	status)
+{
+	waitingEvent_t*	newWE = new waitingEvent_t;
+	newWE->task = task;
+	newWE->port = (port ? port : itsFrameworkPort);
+	newWE->handlingType = 1;	// TODO: do something with this irt seqNr and place in queue
+	newWE->seqNr = 0;
+	newWE->event = event.clone();
+
+	string	taskName((task ? ((GCFTask*)task)->getName() : "?"));
+	LOG_TRACE_STAT_STR("theEventQueue.push(" << eventName(event) << "@" << newWE->port->getName() << 
+				  " for " << taskName << ") => " << theEventQueue.size() + 1);
+
+	theEventQueue.push_back(newWE);
+}
+
+//
+// handleEventQueue
+//
+void GCFScheduler::handleEventQueue()
+{
+	if (!itsUseQueue) {
+		return;
+	}
+
+	printEventQueue();
+
+	int	eventsInQ = theEventQueue.size(); // only handle the event that are in the queue NOW.
+	for (int eventNr = 0; eventNr < eventsInQ; eventNr++) {
+		waitingEvent_t*		theQueueEntry = theEventQueue.front();
+
+		string	taskName((theQueueEntry->task ? ((GCFTask*)theQueueEntry->task)->getName() : "?"));
+		LOG_TRACE_STAT_STR("theEventQueue.pop(" << eventName(*(theQueueEntry->event)) << "@" << 
+					   theQueueEntry->port->getName() << " for " << taskName << 
+					   ") <= " << theEventQueue.size());
+
+		// TODO: add handling dependant from the handlingType
+		GCFEvent::TResult	status = _sendEvent(theQueueEntry->task, *(theQueueEntry->event), 
+												theQueueEntry->port);
+	
+		// Handle message according to return status.
+		bool	handled(true);
+		if (F_EVT_PROTOCOL(*(theQueueEntry->event)) == F_FSM_PROTOCOL) {
+			// FSM events are never send again, you get one shot only.
+			if (status != GCFEvent::HANDLED) {
+				LOG_WARN_STR("Event " << eventName(*(theQueueEntry->event)) << " in task " << taskName << 
+							 " NOT HANDLED, deleting it");
+			}
+			// when this command was an entry in a new state, empty the task queue first
+			if (theQueueEntry->event->signal == F_ENTRY) {
+				theQueueEntry->task->handleTaskQueue();
+			}
+		}
+		else { // all other protocols
+			switch (status) {
+			case GCFEvent::HANDLED:
+				break;
+
+			case GCFEvent::NOT_HANDLED:
+//				LOG_DEBUG("Returning event to the queue because status is NOT_HANDLED");
+//				theEventQueue.push_back(theQueueEntry);
+//				handled = false;
+				LOG_TRACE_COND_STR("DELETING event " << eventName(*(theQueueEntry->event)) << 
+							  " because return status is NOT_HANDLED");
+				handled = true;
+				break;
+
+			case GCFEvent::NEXT_STATE:
+				LOG_TRACE_COND("Moving event to eventQ of task, waiting there for state switch");
+				theQueueEntry->task->queueTaskEvent(*(theQueueEntry->event), *(theQueueEntry->port));
+				handled = false;
+				break;
+			} // switch
+		} // else
+
+		// throw away the handled event
+		theEventQueue.pop_front();
+		if (handled) {
+			LOG_TRACE_STAT_STR("Event " << eventName(*(theQueueEntry->event)) << " in task " << taskName << 
+							 " removed from queue");
+			if (status != GCFEvent::NEXT_STATE) {
+				delete theQueueEntry->event;
+			}
+			delete theQueueEntry;
+		}
+		
+	} // for
+}
+
+//
+// printEventQueue()
+//
+void GCFScheduler::printEventQueue()
+{
+	list<waitingEvent_t*>::iterator		iter = theEventQueue.begin();
+	list<waitingEvent_t*>::iterator		end  = theEventQueue.end();
+	int		nr(1);	
+	while (iter != end) {
+		string	taskName((*iter)->task ? ((GCFTask*)((*iter)->task))->getName() : "?");
+		LOG_TRACE_STAT_STR("theEventQueue[" << nr << "] = (" << eventName(*((*iter)->event)) << "@" << 
+					   (*iter)->port->getName() << " for " << taskName << ")");
+		nr++;
+		++iter;
+	}
+}
+
+//
+// signalHandler(sig)
+//
+void GCFScheduler::signalHandler(int sig)
+{
+	if ((sig == SIGINT) || (sig == SIGTERM)) {
+		GCFScheduler::instance()->stop();
+	}
+}                                            
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
diff --git a/MAC/GCF/TM/src/GCF_Task.cc b/MAC/GCF/TM/src/GCF_Task.cc
deleted file mode 100644
index dfb89807544d5f05c37262f7077b924f6ccf8419..0000000000000000000000000000000000000000
--- a/MAC/GCF/TM/src/GCF_Task.cc
+++ /dev/null
@@ -1,238 +0,0 @@
-//#  GCF_Task.cc: task class which encapsulates a task and its behaviour as a 
-//#  finite state machine (FSM).
-//#
-//#  Copyright (C) 2002-2003
-//#  ASTRON (Netherlands Foundation for Research in Astronomy)
-//#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
-//#
-//#  This program 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.
-//#
-//#  This program 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 this program; if not, write to the Free Software
-//#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-//#
-//#  $Id$
-
-#include <lofar_config.h>
-#include <Common/LofarLogger.h>
-
-#include <GCF/TM/GCF_Protocols.h>
-#include <GCF/TM/GCF_Task.h>
-#include <GTM_Defines.h>
-#include <GCF/TM/GCF_Handler.h>
-
-#include <GCF/TM/GCF_PortInterface.h>
-
-#include <Common/lofar_fstream.h>
-#include <Common/LofarLocators.h>
-#include <Common/ParameterSet.h>
-using std::ifstream;
-
-#include <signal.h>
-#include <sys/time.h>
-
-namespace LOFAR {
-  namespace GCF {
-    namespace TM {
-
-// static member initialisation
-bool				GCFTask::_doExit = false;
-GCFTask::THandlers	GCFTask::_handlers;
-GCFTask::THandlers	GCFTask::_tempHandlers;
-GCFTask::TProtocols	GCFTask::_protocols;
-int 				GCFTask::_argc = 0;
-char** 				GCFTask::_argv = 0;
-bool				GCFTask::_delayedQuit = false;
-
-//
-// GCFTask(state, name)
-//
-GCFTask::GCFTask(State initial, const string& name) :
-  GCFFsm(initial), _name(name)
-{
-	// new style registration
-	registerProtocol(F_FSM_PROTOCOL, F_FSM_PROTOCOL_STRINGS);
-	registerProtocol(F_PORT_PROTOCOL,F_PORT_PROTOCOL_STRINGS);
-}
-
-//
-// ~GCFTask()
-//
-GCFTask::~GCFTask()
-{
-}
-
-//
-// init(argc, argv, logfile)
-//
-void GCFTask::init(int argc, char** argv, const string&	logfile)
-{
-	_argc = argc;
-	_argv = argv;
-
-	// Try to open the log_prop file, if process has its own log_prop file then use it
-	// the INIT_LOGGER otherwise use the default mac.log_prop
-	ConfigLocator	aCL;
-	string 			procName(basename(argv[0]));
-	string			logPropFile(procName + ".log_prop");
-	// First try logpropfile <task>.log_prop
-	if (aCL.locate(logPropFile) == "") {
-		// locator could not find it try defaultname
-		logPropFile = "mac.log_prop";
-	}
-
-	if (logfile.empty()) {
-		INIT_LOGGER(aCL.locate(logPropFile).c_str());
-		LOG_INFO_STR ("Initialized logsystem with: " << aCL.locate(logPropFile));
-	}
-	else {
-		INIT_VAR_LOGGER(aCL.locate(logPropFile).c_str(), logfile);
-		LOG_INFO_STR ("Initialized logsystem with: " << aCL.locate(logPropFile) <<
-						"," << logfile);
-	}
-
-	// Read in the ParameterSet of the task (<task>.conf)
-	ParameterSet*	pParamSet = globalParameterSet();
-	string			configFile(aCL.locate(procName + ".conf"));
-	if (!configFile.empty()) {
-		LOG_INFO_STR ("Using parameterfile: " << configFile);
-		pParamSet->adoptFile(configFile);
-	}
-	else {
-		LOG_INFO_STR ("NO DEFAULT PARAMETERSET FOUND");
-	}
-
-	if (_doExit) {
-		exit(-1);
-	}
-}
-
-//
-// run(secondsToRun)
-//
-void GCFTask::run(double maxSecondsToRun)
-{
-	// catch terminate signals
-	signal(SIGINT,  GCFTask::signalHandler);
-	signal(SIGTERM, GCFTask::signalHandler);
-	signal(SIGPIPE, SIG_IGN);
-
-	double	terminateTime(0.0);
-	struct timeval	TV;
-	if (maxSecondsToRun) {
-		LOG_INFO_STR("Program execution stops over " << maxSecondsToRun << " seconds");
-		gettimeofday(&TV, 0);
-		terminateTime = TV.tv_sec + (TV.tv_usec / 10000000) + maxSecondsToRun;
-	}
-
-	// THE MAIN LOOP OF THE MAC PROCESS
-	// can only be interrupted/stopped by calling stop or terminating the application
-	while (!_doExit) {
-		// new handlers can be add during processing the workProc
-		// thus a temp handler map is used
-		_tempHandlers.clear();
-		_tempHandlers.insert(_handlers.begin(), _handlers.end()); 
-		for (THandlers::iterator iter = _tempHandlers.begin() ;
-				iter != _tempHandlers.end() && !_doExit; ++iter) {
-			if (iter->second) {
-				iter->first->workProc();
-			}
-		} // for
-
-		// time to quit?
-		if (maxSecondsToRun) {
-			gettimeofday(&TV, 0);
-			if ((TV.tv_sec + (TV.tv_usec / 10000000)) >= terminateTime) {
-				_doExit = true;
-			}
-		}
-	} // while
-
-	if (!_delayedQuit) {
-		stopHandlers();
-	}
-	else {
-		_delayedQuit = false;	// never delay twice
-		_doExit = false;		// we will run again
-	}
-}
-
-//
-// stopHandlers()
-//
-// An application can be stopped in two ways, a task itself may call stop() or
-// the user may kill the program.
-//
-void GCFTask::stopHandlers()
-{
-	for (THandlers::iterator iter = _handlers.begin() ; iter != _handlers.end() ; ++iter) {
-		if (iter->second)  {	// if pointer is still valid
-			iter->first->stop();	// give handler a way of stopping in a neat way
-		}
-	} 
-
-	// STEP 2
-	LOG_INFO("Process is stopped! Possible reasons: 'stop' called or terminated");
-	GCFHandler* pHandler(0);
-	for (THandlers::iterator iter = _handlers.begin() ; iter != _handlers.end(); ++iter) {
-		if (!iter->second)  {
-			continue; // handler pointer is not valid anymore, 
-		}
-		// because this handler was deleted by the user
-		pHandler = iter->first;
-		pHandler->leave(); // "process" is also a handler user, see registerHandler
-		if (pHandler->mayDeleted())  { // no other object uses this handler anymore?
-			delete pHandler;
-		}
-	} 
-
-	_handlers.clear();
-}
-
-//
-// registerHandler(handler)
-//
-// NOTE: There are only a few handlers defined, timerHandler, fileHandler, PVSS Handler.
-//	Those handlers handle the work of all 'ports' of that type. E.g. the timerHandler handles
-// 	the decrement of all timers defined in all tasks!!!!
-//
-void GCFTask::registerHandler(GCFHandler& handler)
-{
-	_handlers[&handler] = true; // valid pointer
-	handler.use(); // released after stop
-}
-
-//
-// deregisterHandler(handler)
-//
-void GCFTask::deregisterHandler(GCFHandler& handler)
-{
-	THandlers::iterator iter = _tempHandlers.find(&handler);
-	if (iter != _tempHandlers.end()) {
-		iter->second = false; 	// pointer will be made invalid because the user 
-								// deletes the handler by itself                          
-	}
-	_handlers.erase(&handler);
-}
-
-//
-// signalHandler(sig)
-//
-void GCFTask::signalHandler(int sig)
-{
-	if ((sig == SIGINT) || (sig == SIGTERM)) {
-		_doExit = true;
-	}
-}                                            
-
-  } // namespace TM
- } // namespace GCF
-} // namespace LOFAR
diff --git a/MAC/GCF/TM/src/Makefile.am b/MAC/GCF/TM/src/Makefile.am
index 513b4ee17013a4be3ed9a18850062e9cff4dd4d6..70d01bf98af8a91442e5b3e4170636692b70214e 100644
--- a/MAC/GCF/TM/src/Makefile.am
+++ b/MAC/GCF/TM/src/Makefile.am
@@ -17,9 +17,10 @@ DOCHDRS = \
 lib_LTLIBRARIES 	= libgcftm.la
 
 libgcftm_la_SOURCES= Package__Version.cc  $(DOCHDRS) \
+  GCF_Handler.cc \
+  GCF_Scheduler.cc \
   GCF_Fsm.cc \
   GCF_Protocols.cc \
-  GCF_Task.cc \
   Port/GCF_PortInterface.cc \
   Port/GCF_Port.cc \
   Port/GCF_RawPort.cc \
@@ -38,7 +39,7 @@ libgcftm_la_SOURCES= Package__Version.cc  $(DOCHDRS) \
   ServiceBroker/GTM_SBTCPPort.cc \
   ServiceBroker/ServiceBrokerTask.cc 
 
-libgcftm_la_CPPFLAGS=-I$(top_srcdir)/src/ServiceBroker
+libgcftm_la_CPPFLAGS=-I$(top_srcdir)/src/ServiceBroker 
 
 libgcftm_la_CXXFLAGS=-fmessage-length=0
 
diff --git a/MAC/GCF/TM/src/Port/GCF_PortInterface.cc b/MAC/GCF/TM/src/Port/GCF_PortInterface.cc
index 7e4a408548c3899597967eca7eb670efd0e9a6a4..f81e217b8f24c2507834f8603fb9c1b6ad48d767 100644
--- a/MAC/GCF/TM/src/Port/GCF_PortInterface.cc
+++ b/MAC/GCF/TM/src/Port/GCF_PortInterface.cc
@@ -110,6 +110,17 @@ string GCFPortInterface::makeServiceName() const
 	return(formatString("%s:%s", _pTask->getName().c_str(), _name.c_str()));
 }
 
+//
+// dispatch(e)
+//
+// NB: this function is added for the GCFScheduler.
+//
+GCFEvent::TResult   GCFPortInterface::dispatch  (GCFEvent& event)
+{ 
+	return (_pTask->doEvent(event, *this)); 
+}
+
+
   } // namespace TM
  } // namespace GCF
 } // namespace LOFAR
diff --git a/MAC/GCF/TM/src/Port/GCF_RawPort.cc b/MAC/GCF/TM/src/Port/GCF_RawPort.cc
index 8157592c0c3816f9d32a7ca0032f5640edb16225..1c44b43d4ac9b4b09e558d6740d6e430172f36c7 100644
--- a/MAC/GCF/TM/src/Port/GCF_RawPort.cc
+++ b/MAC/GCF/TM/src/Port/GCF_RawPort.cc
@@ -36,11 +36,6 @@ namespace LOFAR {
  namespace GCF {
   namespace TM {
 
-// static framework events
-static GCFEvent disconnectedEvent(F_DISCONNECTED);
-static GCFEvent connectedEvent   (F_CONNECTED);
-static GCFEvent closedEvent      (F_CLOSED);
-
 //
 // GCFRawPort(task, name, type, protocol, raw)
 //
@@ -50,10 +45,14 @@ GCFRawPort::GCFRawPort(GCFTask& 	 task,
                        int 			 protocol,
                        bool 		 transportRawData) : 
     GCFPortInterface(&task, name, type, protocol, transportRawData),   
-    _pMaster(0)
+    _pMaster(0),
+	itsScheduler(0)
 {
 	_pTimerHandler = GTMTimerHandler::instance(); 
-	ASSERT(_pTimerHandler);
+	ASSERTSTR(_pTimerHandler, "Cannot reach the Timer handler");
+
+	itsScheduler = GCFScheduler::instance();
+	ASSERTSTR(itsScheduler, "Cannot reach the GCF scheduler");
 }
 
 //
@@ -64,7 +63,10 @@ GCFRawPort::GCFRawPort() :
     _pMaster(0)
 {
 	_pTimerHandler = GTMTimerHandler::instance(); 
-	ASSERT(_pTimerHandler);
+	ASSERTSTR(_pTimerHandler, "Cannot reach the Timer handler");
+
+	itsScheduler = GCFScheduler::instance();
+	ASSERTSTR(itsScheduler, "Cannot reach the GCF scheduler");
 }
 
 //
@@ -96,7 +98,6 @@ GCFRawPort::~GCFRawPort()
 //
 GCFEvent::TResult GCFRawPort::dispatch(GCFEvent& event)
 {
-	GCFEvent::TResult status = GCFEvent::NOT_HANDLED;
 	ASSERT(_pTask);
 
 	// Test whether the event is a framework event or not
@@ -105,7 +106,6 @@ GCFEvent::TResult GCFRawPort::dispatch(GCFEvent& event)
 						  (F_EVT_PROTOCOL(event) != F_PORT_PROTOCOL)) {
 		// Inform about the fact of an incomming message
 		LOG_DEBUG(formatString ("%s was received on port '%s' in task '%s'",
-//								_pTask->eventName(event).c_str(), 
 								eventName(event).c_str(), 
 								getRealName().c_str(), 
 								_pTask->getName().c_str())); 
@@ -126,16 +126,6 @@ GCFEvent::TResult GCFRawPort::dispatch(GCFEvent& event)
 		_state = S_DISCONNECTED;
 		break;
 
-	case F_TIMER: {
-		// result of the schedule_* methods
-		GCFTimerEvent* pTE = static_cast<GCFTimerEvent*>(&event);
-		if (&disconnectedEvent == pTE->arg || &connectedEvent == pTE->arg ||
-												&closedEvent == pTE->arg) {    
-			return dispatch(*((GCFEvent*) pTE->arg));
-		}
-		break;
-	}
-
 	case F_DATAIN: {
 		// the specific transport implementations informs the rawport about 
 		// incomming data
@@ -147,41 +137,15 @@ GCFEvent::TResult GCFRawPort::dispatch(GCFEvent& event)
 	}
 
 	default:
-	// 170507: This IN/OUT stuff is not very handy in the control-chains.
-	//		   It is also not neccesary to check this because signals will always
-	//		   be catched in switches. It is much more usefull to use these two bits
-	//		   for marking whether a message is an order/request or an acknowlegdement.
-	//		   For now these checks are disabled.
-#if 0
-		if (SPP == getType() && (F_EVT_INOUT(event) == F_OUT)) {    
-			LOG_ERROR(formatString ("Developer error in %s (port %s): "
-									"received an OUT event (%s) in a SPP",
-									_pTask->getName().c_str(), 
-									getRealName().c_str(), 
-									_pTask->eventName(event)));    
-		return (status);
-		}
-		else if (SAP == getType() && (F_EVT_INOUT(event) == F_IN)) {
-			LOG_ERROR(formatString ("Developer error in %s (port %s): "
-									"received an IN event (%s) in a SAP",
-									_pTask->getName().c_str(), 
-									getRealName().c_str(), 
-									_pTask->eventName(event)));    
-			return (status);
-		}
-#endif
 		break;
 	}
 
 	if (isSlave()) {
 		_pMaster->setState(_state);
-		status = _pTask->dispatch(event, *_pMaster);      
-	}
-	else {
-		status = _pTask->dispatch(event, *this);
+		return(_pTask->doEvent(event, *_pMaster));
 	}
 
-	return (status);
+	return(_pTask->doEvent(event, *this));
 }
 
 //
@@ -282,79 +246,54 @@ bool GCFRawPort::findAddr(TPeerAddr& addr)
 	return (true);
 }
 
-//
-// schedule_disconnect()
-//
-void GCFRawPort::schedule_disconnected()
-{
-  // forces a context switch
-  setTimer(0, 0, 0, 0, (void*)&disconnectedEvent);
-}
-
-//
-// schedule_close()
-//
-void GCFRawPort::schedule_close()
-{
-  // forces a context switch
-  setTimer(0, 0, 0, 0, (void*)&closedEvent);
-}
-
-//
-// schedule_connect()
-//
-void GCFRawPort::schedule_connected()
-{
-  // forces a context switch
-  setTimer(0, 0, 0, 0, (void*)&connectedEvent);
-}
-
 //
 // recvEvent()
 //
 GCFEvent::TResult GCFRawPort::recvEvent()
 {
-	GCFEvent::TResult status = GCFEvent::NOT_HANDLED;
+	bool		error (false);
+	GCFEvent	e;
+	char* 		event_buf(0);
+	GCFEvent*	full_event(&e);
 
-	GCFEvent e;
 	// expects and reads signal
 	if (recv(&e.signal, sizeof(e.signal)) != sizeof(e.signal)) {
+		error = true;
 		// don't continue with receiving
 	}
 	// expects and reads length
 	else if (recv(&e.length, sizeof(e.length)) != sizeof(e.length)) {
+		error = true;
 		// don't continue with receiving
 	}  
 	// reads payload if specified
 	else if (e.length > 0) {
-		GCFEvent* full_event = 0;
-		char* event_buf = new char[sizeof(e) + e.length];
-		full_event = (GCFEvent*)event_buf;
+		event_buf = new char[sizeof(e) + e.length];
 		memcpy(event_buf, &e, sizeof(e));
+		full_event = (GCFEvent*)event_buf;
 
 		// read the payload right behind the just memcopied basic event struct
-		if (recv(event_buf + sizeof(e), e.length) > 0) {          
-			// dispatchs an event with just received params
-			status = dispatch(*full_event);
+		if (recv(event_buf + sizeof(e), e.length) != e.length) {
+			error = true;
 		}    
-		delete [] event_buf;
-	}
-	// dispatchs an event without params
-	else {
-		status = dispatch(e);
 	}
 
-	if (status != GCFEvent::HANDLED) {
-		ASSERT(getTask());
-		LOG_DEBUG(formatString (
-			"'%s' for port '%s' in task '%s' not handled or an error occured",
-//			getTask()->eventName(e).c_str(), 
-			eventName(e).c_str(), 
-			getRealName().c_str(),
-			getTask()->getName().c_str()));
+	// receive errors?
+	if (error) {
+		LOG_ERROR_STR("Error during receiption of an event on port " << getRealName());
+		if (event_buf) {
+			delete [] event_buf;
+		}
+		return (GCFEvent::NOT_HANDLED);
 	}
 
-	return (status);
+	// dispatch the event to the task
+	itsScheduler->queueEvent(const_cast<GCFTask*>(getTask()), *full_event, this);
+
+	if (event_buf) {
+		delete [] event_buf;
+	}
+	return (GCFEvent::HANDLED);
 }
 
 //
diff --git a/MAC/GCF/TM/src/PortImpl/GCF_DevicePort.cc b/MAC/GCF/TM/src/PortImpl/GCF_DevicePort.cc
index dec6fb4964c795e1cc81e2f00bf6ddb9c0f5bdec..03296270f35505f917cabb133b17043e4a255c9a 100644
--- a/MAC/GCF/TM/src/PortImpl/GCF_DevicePort.cc
+++ b/MAC/GCF/TM/src/PortImpl/GCF_DevicePort.cc
@@ -76,68 +76,47 @@ GCFDevicePort::~GCFDevicePort()
 
 bool GCFDevicePort::open()
 {
-  if (isConnected())
-  {
-    LOG_ERROR(formatString ( 
-        "Port %s already open.",
-	      getRealName().c_str()));
+  if (isConnected()) {
+    LOG_ERROR(formatString ( "Port %s already open.", getRealName().c_str()));
     return false;
   }
-  else if (SAP != getType())
-  {
-    LOG_ERROR(formatString ( 
-        "Device ports only can act as a SAP (%s).",
-        getRealName().c_str()));
+
+  if (SAP != getType()) {
+    LOG_ERROR(formatString ( "Device ports only can act as a SAP (%s).", getRealName().c_str()));
     return false;
   }
-  else if (!_pDevice)
-  {
-    if (isSlave())
-    {
-      LOG_ERROR(formatString ( 
-          "Port %s not initialised.",
-          getRealName().c_str()));
+  
+  if (!_pDevice) {
+    if (isSlave()) {
+      LOG_ERROR(formatString ( "Port %s not initialised.", getRealName().c_str()));
       return false;
     }
-    else
-    {
-      _pDevice = new GTMDevice(*this);
-    }
+    _pDevice = new GTMDevice(*this);
   }
 
-  try
-  {
-    if (!_devNameIsSet)
-    {
+  try {
+    if (!_devNameIsSet) {
       // retrieve the device name from the parameter set
       setDeviceName(
           globalParameterSet()->getString(
-              formatString(
-                  "mac.ns.%s.%s.deviceName",
-                  _pTask->getName().c_str(),
-                  getRealName().c_str())
+              formatString( "mac.ns.%s.%s.deviceName", _pTask->getName().c_str(), getRealName().c_str())
               )
           );    
     }
   }
-  catch (...)
-  {
-    if (!_devNameIsSet)
-    {
-      LOG_ERROR(formatString (
-          "Could not get address info for port '%s' of task '%s'",
+  catch (...) {
+    if (!_devNameIsSet) {
+      LOG_ERROR(formatString ( "Could not get address info for port '%s' of task '%s'",
           getRealName().c_str(), _pTask->getName().c_str()));
       return false;
     }
   }
 
-  if (_pDevice->open(_deviceName))
-  { 
+  if (_pDevice->open(_deviceName)) { 
     setState(S_CONNECTING);
     schedule_connected();
   }
-  else
-  {
+  else {
     setState(S_DISCONNECTING);
     schedule_disconnected();
   }
@@ -148,10 +127,8 @@ ssize_t GCFDevicePort::send(GCFEvent& e)
 {
   size_t written = 0;
   
-  if (!isConnected()) 
-  {
-    LOG_ERROR(formatString (
-        "Port '%s' on task '%s' not connected! Event not sent!",
+  if (!isConnected()) {
+    LOG_ERROR(formatString ( "Port '%s' on task '%s' not connected! Event not sent!",
         getRealName().c_str(),
         getTask()->getName().c_str()));
     return 0;
@@ -169,11 +146,8 @@ ssize_t GCFDevicePort::send(GCFEvent& e)
       getTask()->getName().c_str(), 
       getRealName().c_str()));
 
-  if ((written = _pDevice->send(buf, packsize)) != packsize)
-  {
-    LOG_DEBUG(formatString (
-        "truncated send: %s",
-        strerror(errno)));
+  if ((written = _pDevice->send(buf, packsize)) != packsize) {
+    LOG_DEBUG(formatString ( "truncated send: %s", strerror(errno)));
       
     setState(S_DISCONNECTING);    
     schedule_disconnected();
diff --git a/MAC/GCF/TM/src/PortImpl/GCF_ETHRawPort.cc b/MAC/GCF/TM/src/PortImpl/GCF_ETHRawPort.cc
index 13349ada7e24a775f38ed256a44cd2450ea60144..1e489d0b1584b5ab1a5c82ee8f5d782d0350e9db 100644
--- a/MAC/GCF/TM/src/PortImpl/GCF_ETHRawPort.cc
+++ b/MAC/GCF/TM/src/PortImpl/GCF_ETHRawPort.cc
@@ -66,8 +66,6 @@ GCFETHRawPort::~GCFETHRawPort()
 
 bool GCFETHRawPort::close()
 {
-  LOG_DEBUG("close -> schedule_close");
-
   setState(S_CLOSING);
   schedule_close();
 
diff --git a/MAC/GCF/TM/src/PortImpl/GCF_ITCPort.cc b/MAC/GCF/TM/src/PortImpl/GCF_ITCPort.cc
index 1801a1eb067f074d6e653c3282b5600c368bce0a..25d1a880619f0a90c38d3edd0fbdb6ad0973f762 100644
--- a/MAC/GCF/TM/src/PortImpl/GCF_ITCPort.cc
+++ b/MAC/GCF/TM/src/PortImpl/GCF_ITCPort.cc
@@ -149,7 +149,7 @@ GCFEvent::TResult GCFITCPort::dispatch(GCFEvent& event)
 
 				// client timer expired? dispatch to slave
 				if (clientIt != itsToSlaveTimerId.end()) {
-					status = itsSlaveTask.dispatch(*pActualEvent, *this);
+					status = itsSlaveTask.doEvent(*pActualEvent, *this);
 					// extra check to see if it still exists:
 					clientIt = itsToSlaveTimerId.find(timerEvent.id);
 					if (clientIt != itsToSlaveTimerId.end()) {
@@ -158,7 +158,7 @@ GCFEvent::TResult GCFITCPort::dispatch(GCFEvent& event)
 				}
 				// server timer expired? dispatch to server
 				else if (serverIt != itsToContainerTimerId.end()) {
-					status = _pTask->dispatch(*pActualEvent, *this);
+					status = _pTask->doEvent(*pActualEvent, *this);
 					// extra check to see if it still exists:
 					serverIt = itsToContainerTimerId.find(timerEvent.id);
 					if (serverIt != itsToContainerTimerId.end()) {
diff --git a/MAC/GCF/TM/src/PortImpl/GCF_TCPPort.cc b/MAC/GCF/TM/src/PortImpl/GCF_TCPPort.cc
index 1c25d3d71063e0d05e1fedd5cd0c0915005459f4..525314e6ddfca80244c3d652b6bb1bc30f22484f 100644
--- a/MAC/GCF/TM/src/PortImpl/GCF_TCPPort.cc
+++ b/MAC/GCF/TM/src/PortImpl/GCF_TCPPort.cc
@@ -29,10 +29,10 @@
 #include <GCF/TM/GCF_Task.h>
 #include <GCF/TM/GCF_Protocols.h>
 #include <Common/ParameterSet.h>
-#include "GTM_TCPServerSocket.h"
+#include <Timer/GTM_TimerHandler.h>
 #include <ServiceBroker/ServiceBrokerTask.h>
-//#include <ServiceBroker/GSB_Defines.h>
 #include <GTM_Defines.h>
+#include "GTM_TCPServerSocket.h"
 #include <errno.h>
 
 namespace LOFAR {
@@ -50,13 +50,18 @@ GCFTCPPort::GCFTCPPort(GCFTask& 	 task,
                        int 			 protocol, 
                        bool 		 transportRawData) 
   : GCFRawPort(task, name, type, protocol, transportRawData),
-    _pSocket(0),
-    _addrIsSet(false),
-	_addr(),
-	_host(myHostname(false)),
-    _portNumber(0),
-	itsFixedPortNr(false),
-    _broker(0)
+    _pSocket		  (0),
+    _addrIsSet		  (false),
+	_addr			  (),
+	_host			  (myHostname(false)),
+    _portNumber		  (0),
+	itsFixedPortNr	  (false),
+	itsAutoOpen		  (false),
+	itsAutoOpenTimer  (0),
+	itsAutoRetryTimer (0),
+	itsAutoRetries	  (0),
+	itsAutoRetryItv	  (0.0),
+    _broker			  (0)
 {
 	if (SPP == getType() || MSPP == getType()) {
 		_pSocket = new GTMTCPServerSocket(*this, (MSPP == type));
@@ -71,13 +76,18 @@ GCFTCPPort::GCFTCPPort(GCFTask& 	 task,
 //
 GCFTCPPort::GCFTCPPort()
     : GCFRawPort(),
-    _pSocket(0),
-    _addrIsSet(false),
-	_addr(),
-	_host(myHostname(false)),
-    _portNumber(0),
-	itsFixedPortNr(false),
-    _broker(0)
+    _pSocket		  (0),
+    _addrIsSet		  (false),
+	_addr			  (),
+	_host			  (myHostname(false)),
+    _portNumber		  (0),
+	itsFixedPortNr	  (false),
+	itsAutoOpen		  (false),
+	itsAutoOpenTimer  (0),
+	itsAutoRetryTimer (0),
+	itsAutoRetries	  (0),
+	itsAutoRetryItv	  (0.0),
+    _broker			  (0)
 {
 }
 
@@ -120,9 +130,10 @@ void GCFTCPPort::init(GCFTask& 		task,
 }
 
 //
-// try to open the socket
-// Remember that this routine may be called many times before a socket is
-// really open.
+// Try to open the socket
+// Remember that this routine may be called many times before a socket is realy open.
+//
+// NOTE: the return state reflects whether or not an answer is already send to the caller.
 //
 bool GCFTCPPort::open()
 {
@@ -155,7 +166,7 @@ bool GCFTCPPort::open()
 		if (_portNumber != 0) {					// dest. overruled by user?
 												// or answer already received before
 			// Try to 'open' en 'connect' to port
-			serviceInfo(SB_NO_ERROR, _portNumber, _host);
+			serviceInfo(SB_NO_ERROR, _portNumber, _host);		// sends a F_CONNECTED
 			return (true);
 		}
 
@@ -190,29 +201,127 @@ bool GCFTCPPort::open()
 		ASSERT(_broker);
 		_broker->getServiceinfo(*this, remoteServiceName, _host);
 		// a (dis)connect event will be scheduled
-		return (true);
+		return (false);	// REO: changed that
 	}
 
 	// porttype = MSPP or SPP
 	// portnumber overruled by user? try mac.ns.<taskname>.<realname>.port
-	string portNumParam = formatString(PARAM_TCP_PORTNR, 
-						getTask()->getName().c_str(), getRealName().c_str());
+	string portNumParam = formatString(PARAM_TCP_PORTNR, getTask()->getName().c_str(), getRealName().c_str());
 	if (globalParameterSet()->isDefined(portNumParam)) {
 		_portNumber = globalParameterSet()->getInt32(portNumParam);
 	}
 	if (_portNumber > 0) {					// portnumber hard set by user.
 		serviceRegistered(SB_NO_ERROR, _portNumber);	// 'hard' open port
-		// a (dis)connect event will be scheduled
-		// Note: service is NOT registered at service broker!!!
+		return (true);
 	}
-	else {	// portnumber not overruled by user so ask SB for a portnumber
-		_broker = ServiceBrokerTask::instance();
-		ASSERT(_broker);
-		_broker->registerService(*this);
-		// a (dis)connect event will be scheduled
+
+	// portnumber not overruled by user so ask SB for a portnumber
+	_broker = ServiceBrokerTask::instance();
+	ASSERT(_broker);
+	_broker->registerService(*this); // a (dis)connect event will be scheduled
+	return (false);	// REO changed that
+}
+
+//
+// autoOpen(nrRetries, timeout, reconnectInterval)
+//	Will generate a F_CONNECTED or F_DISCONNECTED event.
+//
+void GCFTCPPort::autoOpen(uint	nrRetries, double	timeout, double	reconnectInterval)
+{
+	itsAutoOpen = true;
+
+	if (open()) {							// first try to open it
+		return;
+	}
+
+	// It is not open yet. But the call to open() activated the ServiceBroker task to do it job.
+	// All we have to do is copy the user settings, (start a timer) and wait.
+
+	itsAutoOpenTimer  = 0;
+	itsAutoRetryTimer = 0;
+	itsAutoRetries    = nrRetries;
+	itsAutoRetryItv   = reconnectInterval;
+	if (timeout > 0.0) {		// absolute max auto-open time specified? Set timer for doomsday.
+		itsAutoOpenTimer = _pTimerHandler->setTimer(*this, (uint64)(1000000.0*timeout), 0, &itsAutoOpenTimer);
+		if (itsAutoRetries == 0) {
+			itsAutoRetries = -1;		// to let the timeout timer running
+		}
+	}
+}
+
+//
+// _handleDisconnect()
+//
+void GCFTCPPort::_handleDisconnect()
+{
+	LOG_TRACE_COND_STR("_handleDisco:autoOpen=" << (itsAutoOpen ? "Yes" : "No") << ", nrRetries=" << itsAutoRetries << ", retryTimer=" << itsAutoRetryTimer << ", maxTimer=" << itsAutoOpenTimer);
+
+	// retries left?
+	if (itsAutoOpen) {
+		if (itsAutoRetries != 0) {
+			itsAutoRetryTimer = _pTimerHandler->setTimer(*this, (uint64)(1000000.0*itsAutoRetryItv), 0, &itsAutoRetryTimer);
+			return;
+		}
+	}
+
+	// stop auto timer
+	if (itsAutoOpenTimer) {
+		_pTimerHandler->cancelTimer(itsAutoOpenTimer);
+		itsAutoOpenTimer = 0;
+	}
+	if (itsAutoRetryTimer) {
+		_pTimerHandler->cancelTimer(itsAutoRetryTimer);
+		itsAutoRetryTimer = 0;
+	}
+
+	// inform user
+	schedule_disconnected();
+}
+
+//
+// _handleConnect()
+//
+void GCFTCPPort::_handleConnect()
+{
+	// stop auto timer
+	if (itsAutoOpenTimer) {
+		_pTimerHandler->cancelTimer(itsAutoOpenTimer);
+		itsAutoOpenTimer = 0;
+	}
+	if (itsAutoRetryTimer) {
+		_pTimerHandler->cancelTimer(itsAutoRetryTimer);
+		itsAutoRetryTimer = 0;
+	}
+	itsAutoOpen = false;
+
+	// inform user
+	schedule_connected();
+}
+
+//
+// dispatch(event)
+//
+GCFEvent::TResult	GCFTCPPort::dispatch(GCFEvent&	event)
+{
+	if (event.signal == F_TIMER) {
+		GCFTimerEvent	*TEptr = static_cast<GCFTimerEvent*>(&event);
+		if (TEptr->arg == &itsAutoOpenTimer) {	// Max auto open time reached?
+			itsAutoRetries   = 0;
+			itsAutoOpenTimer = 0;
+			_handleDisconnect();
+			return (GCFEvent::HANDLED);
+		}
+		if (TEptr->arg == &itsAutoRetryTimer) {
+			if (itsAutoRetries > 0) {		// don't lower counter when it is set by the maxTimer
+				itsAutoRetries--;
+			}
+			itsAutoRetryTimer = 0;
+			open();
+			return (GCFEvent::HANDLED);
+		}
 	}
 
-	return (true);
+	return(GCFRawPort::dispatch(event));	// call dispatch from parent (RawPort).
 }
 
 
@@ -226,22 +335,20 @@ void GCFTCPPort::serviceRegistered(unsigned int result, unsigned int portNumber)
 {
 	ASSERT(MSPP == getType() || SPP == getType());
 	if (result != SB_NO_ERROR) {
-		schedule_disconnected();
+		_handleDisconnect();
 		return;
 	}
 
-	LOG_DEBUG(formatString (
-				"(M)SPP port '%s' in task '%s' listens on portnumber %d.",
-				getRealName().c_str(), _pTask->getName().c_str(),
-				portNumber));
+	LOG_DEBUG(formatString ( "(M)SPP port '%s' in task '%s' listens on portnumber %d.",
+				getRealName().c_str(), _pTask->getName().c_str(), portNumber));
 	_portNumber = portNumber;
 	if (!_pSocket->open(portNumber)) {
-		schedule_disconnected();
+		_handleDisconnect();
 		return;
 	}
 
 	if (getType() == MSPP) {
-		schedule_connected();
+		_handleConnect();
 	}
 }
 
@@ -262,7 +369,7 @@ void GCFTCPPort::serviceInfo(unsigned int result, unsigned int portNumber, const
 								makeServiceName().c_str(),
 								_addr.taskname.c_str(), _addr.portname.c_str()));
 
-		schedule_disconnected();
+		_handleDisconnect();
 		return;
 	}
 
@@ -276,12 +383,13 @@ void GCFTCPPort::serviceInfo(unsigned int result, unsigned int portNumber, const
 								_addr.taskname.c_str(), _addr.portname.c_str(),
 								host.c_str(), portNumber));
 
+		// Note: _pSocket is of type GTMTCPSocket
 		if (_pSocket->open(portNumber) && _pSocket->connect(portNumber, host)) {
-			schedule_connected();
+			_handleConnect();
 			return;
 		}
 
-		schedule_disconnected();
+		_handleDisconnect();
 	}
 }
 
@@ -317,14 +425,13 @@ ssize_t GCFTCPPort::send(GCFEvent& e)
 
 	LOG_TRACE_STAT(formatString (
 						"Sending event '%s' for task '%s' on port '%s'",
-//						getTask()->eventName(e).c_str(), 
 						eventName(e).c_str(), 
 						getTask()->getName().c_str(), 
 						getRealName().c_str()));
 
 	if ((written = _pSocket->send(buf, packsize)) != (ssize_t) packsize) {  
 		setState(S_DISCONNECTING);     
-		schedule_disconnected();
+		_handleDisconnect();
 
 		written = 0;
 	}
@@ -347,10 +454,10 @@ ssize_t GCFTCPPort::recv(void* buf, size_t count)
 		return 0;
 	}
 
-	ssize_t	btsRead = _pSocket->recv(buf, count);
+	ssize_t	btsRead = _pSocket->recv(buf, count, isTransportRawData());
 	if (btsRead == 0) {
 		setState(S_DISCONNECTING);     
-		schedule_disconnected();
+		_handleDisconnect();
 	}
 
 	return (btsRead);
@@ -419,7 +526,7 @@ bool GCFTCPPort::accept(GCFTCPPort& port)
 
 	if (pProvider->accept(*port._pSocket)) {
 		setState(S_CONNECTING);        
-		port.schedule_connected();
+		port.schedule_connected();		// NO _handleConnect()  !!!!
 		result = true;
 	}
 	return result;
diff --git a/MAC/GCF/TM/src/PortImpl/GTM_Device.cc b/MAC/GCF/TM/src/PortImpl/GTM_Device.cc
index d164bf03c31ce88dd06e20fb29026dc14552a97c..e46194dac107ca9dd077c29d0b97a770b554faae 100644
--- a/MAC/GCF/TM/src/PortImpl/GTM_Device.cc
+++ b/MAC/GCF/TM/src/PortImpl/GTM_Device.cc
@@ -60,7 +60,7 @@ ssize_t GTMDevice::send(void* buf, size_t count)
     return 0;
 }
 
-ssize_t GTMDevice::recv(void* buf, size_t count)
+ssize_t GTMDevice::recv(void* buf, size_t count, bool /*raw*/)
 {
   if (_fd > -1) 
     return ::read(_fd, buf, count);
diff --git a/MAC/GCF/TM/src/PortImpl/GTM_Device.h b/MAC/GCF/TM/src/PortImpl/GTM_Device.h
index 1b8df67b3469a137c539a2f44bfc724d4a543858..f95f3051cd133517520872b1cc8474cabfed9f2c 100644
--- a/MAC/GCF/TM/src/PortImpl/GTM_Device.h
+++ b/MAC/GCF/TM/src/PortImpl/GTM_Device.h
@@ -57,7 +57,7 @@ class GTMDevice : public GTMFile
      * send/recv methods
      */
     virtual ssize_t send (void* buf, size_t count);
-    virtual ssize_t recv (void* buf, size_t count);
+    virtual ssize_t recv (void* buf, size_t count, bool raw = false);
 
   private:
     /// default contructor
diff --git a/MAC/GCF/TM/src/PortImpl/GTM_ETHSocket.cc b/MAC/GCF/TM/src/PortImpl/GTM_ETHSocket.cc
index 2de9cfb251fd6075d520f01687d6bfa98961ec38..8a74fff206286df493e633d9eeb79761730d4166 100644
--- a/MAC/GCF/TM/src/PortImpl/GTM_ETHSocket.cc
+++ b/MAC/GCF/TM/src/PortImpl/GTM_ETHSocket.cc
@@ -101,7 +101,7 @@ ssize_t GTMETHSocket::send(void* buf, size_t count)
 /**
  * recv a maximum of count bytes, return actually returned bytes
  */
-ssize_t GTMETHSocket::recv(void* buf, size_t count)
+ssize_t GTMETHSocket::recv(void* buf, size_t count, bool /*raw*/)
 {
   ssize_t received = -1;
 
diff --git a/MAC/GCF/TM/src/PortImpl/GTM_ETHSocket.h b/MAC/GCF/TM/src/PortImpl/GTM_ETHSocket.h
index 414dbec164097b8d370761bec715b872f34dd559..5244ef2027cb0108b8e57c1f906df975dceaa852 100644
--- a/MAC/GCF/TM/src/PortImpl/GTM_ETHSocket.h
+++ b/MAC/GCF/TM/src/PortImpl/GTM_ETHSocket.h
@@ -62,7 +62,7 @@ class GTMETHSocket : public GTMFile
      * send/recv methods
      */
     virtual ssize_t send (void* buf, size_t count);
-    virtual ssize_t recv (void* buf, size_t count);
+    virtual ssize_t recv (void* buf, size_t count, bool raw = false);
 
   private:
     GTMETHSocket ();
diff --git a/MAC/GCF/TM/src/PortImpl/GTM_File.cc b/MAC/GCF/TM/src/PortImpl/GTM_File.cc
index aab656c9f2b83f3b7e37bfb29927807cf3cb6c54..a57853b135286404507231bc62d6d47bcea1003d 100644
--- a/MAC/GCF/TM/src/PortImpl/GTM_File.cc
+++ b/MAC/GCF/TM/src/PortImpl/GTM_File.cc
@@ -28,100 +28,101 @@
 #include "GTM_FileHandler.h"
 #include <GCF/TM/GCF_RawPort.h>
 #include <GCF/TM/GCF_Task.h>
-#include <GTM_Defines.h>
+#include <GCF/TM/GCF_Scheduler.h>
+//#include <GTM_Defines.h>
 #include <GCF/TM/GCF_Protocols.h>
 #include <stdio.h>
 #include <sys/ioctl.h>
 #include <errno.h>
 
-namespace LOFAR 
-{
- namespace GCF 
- {
-  namespace TM 
-  {
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
 
 GTMFile::GTMFile(GCFRawPort& port) :
-  _fd(-1),
-  _pHandler(0),
-  _port(port)
+	_fd(-1),
+	_pHandler(0),
+	_port(port)
 {
-  _pHandler = GTMFileHandler::instance();
-  ASSERT(_pHandler);
+	_pHandler = GTMFileHandler::instance();
+	ASSERT(_pHandler);
+	itsScheduler = GCFScheduler::instance();
+	ASSERT(itsScheduler);
 }
 
 GTMFile::~GTMFile()
 {
-  close();
-  GTMFileHandler::release();
-  _pHandler = 0;
+	close();
+	GTMFileHandler::release();
+	_pHandler = 0;
+	itsScheduler = 0;
 }
 
 bool GTMFile::close()
 {
-  bool result(true);
-  
-  if (_fd > -1)
-  { 
-    ASSERT(_pHandler);
-    _pHandler->deregisterFile(*this);
-    result = (::close(_fd) == 0);
-    if (!result)
-    {
-      LOG_WARN(formatString (
-              "::close, error: %s",
-              strerror(errno)));
-      close();
-    }
-    
-    _fd = -1;
-  }
-  return result;
+	bool result(true);
+
+	if (_fd > -1) { 
+		ASSERT(_pHandler);
+		_pHandler->deregisterFile(*this);
+		result = (::close(_fd) == 0);
+		if (!result) {
+			LOG_WARN(formatString ( "::close, error: %s", strerror(errno)));
+			close();
+		}
+
+		_fd = -1;
+	}
+	return result;
 }
 
 int GTMFile::setFD(int fd)
 {
-  if (fd >= 0)
-  {
-    if (_fd > -1)
-    {
-      close();
-    }
-    _fd = fd;
-    ASSERT(_pHandler);
-    _pHandler->registerFile(*this);
-  }
-  return (fd);    
+	if (fd >= 0) {
+		if (_fd > -1) {
+			close();
+		}
+		_fd = fd;
+		ASSERT(_pHandler);
+		_pHandler->registerFile(*this);
+	}
+	return (fd);    
+}
+
+void GTMFile::doWork()
+{
+	unsigned long bytesRead = 0;
+
+	if (ioctl(_fd, FIONREAD, &bytesRead) > -1) {
+		if (bytesRead == 0) {
+			GCFEvent discoEvent(F_DISCONNECTED);
+			itsScheduler->queueEvent(0, discoEvent, &_port);
+//			_port.dispatch(e);    
+		}
+		else {
+			GCFEvent dataEvent(F_DATAIN);
+			itsScheduler->queueEvent(0, dataEvent, &_port);
+//			_port.dispatch(e);
+		}
+	}
+	else {
+		ASSERT(_port.getTask());
+			LOG_FATAL(LOFAR::formatString ("%s(%s): Error in 'ioctl' on socket fd %d: %s",
+						_port.getTask()->getName().c_str(), 
+						_port.getName().c_str(), 
+						_fd, 
+						strerror(errno)));        
+	}
 }
 
-void GTMFile::workProc()
+//
+// forwardEvent(event)
+//
+void GTMFile::forwardEvent (LOFAR::MACIO::GCFEvent& event) 
 {
-  unsigned long bytesRead = 0;
-  
-  if (ioctl(_fd, FIONREAD, &bytesRead) > -1)
-  {
-    if (bytesRead == 0)
-    {
-      GCFEvent e(F_DISCONNECTED);
-      _port.dispatch(e);    
-    }
-    else 
-    {
-      GCFEvent e(F_DATAIN);
-      _port.dispatch(e);
-    }
-  }
-  else
-  {
-    ASSERT(_port.getTask());
-    LOG_FATAL(LOFAR::formatString (
-        "%s(%s): Error in 'ioctl' on socket fd %d: %s",
-        _port.getTask()->getName().c_str(), 
-        _port.getName().c_str(), 
-        _fd, 
-        strerror(errno)));        
-  }
+	itsScheduler->queueEvent(0, event, &_port);
 }
-  } // namespace TM
- } // namespace GCF
+
+    } // namespace TM
+  } // namespace GCF
 } // namespace LOFAR
diff --git a/MAC/GCF/TM/src/PortImpl/GTM_File.h b/MAC/GCF/TM/src/PortImpl/GTM_File.h
index e45f820c3476da7f35fad2a706cf0af366416d57..ca85e200a75e3df35c8d78c2c9f88c8ae81274dc 100644
--- a/MAC/GCF/TM/src/PortImpl/GTM_File.h
+++ b/MAC/GCF/TM/src/PortImpl/GTM_File.h
@@ -34,6 +34,7 @@ namespace LOFAR {
 // forward declaration
 class GTMFileHandler;
 class GCFRawPort;
+class GCFScheduler;
 
 /**
  * This class consists of the basic implementation of a "file/device". 
@@ -60,34 +61,28 @@ class GTMFile
      * send/recv methods
      */
     virtual ssize_t send (void* buf, size_t count) = 0;
-    virtual ssize_t recv (void* buf, size_t count) = 0;
+    virtual ssize_t recv (void* buf, size_t count, bool raw = false) = 0;
 
     int getFD () const {return _fd;}
     virtual int setFD (int fd);
-    virtual void workProc ();
+    virtual void doWork ();
     
   protected: // helper methods
-    GCFEvent::TResult   dispatch (GCFEvent& event);
+    void forwardEvent (GCFEvent& event);
         
   protected: // data members
     /// filedescriptor
-    int               _fd;
+    int					_fd;
     /// selects on all registered filedescriptors
-    GTMFileHandler*   _pHandler; 
+    GTMFileHandler*		_pHandler; 
     /// related port
-    GCFRawPort&       _port;    
+    GCFRawPort&			_port;    
+	// Pointer to the scheduler.
+	GCFScheduler*		itsScheduler;
 };
 
   } // namespace TM
  } // namespace GCF
 } // namespace LOFAR
 
-#include <GCF/TM/GCF_RawPort.h>
-
-using namespace LOFAR::GCF::TM;
-
-inline LOFAR::MACIO::GCFEvent::TResult GTMFile::dispatch (LOFAR::MACIO::GCFEvent& event) 
-{
-  return _port.dispatch(event);
-}
 #endif
diff --git a/MAC/GCF/TM/src/PortImpl/GTM_FileHandler.cc b/MAC/GCF/TM/src/PortImpl/GTM_FileHandler.cc
index b4482df6fbf25fb8d41c448d5e2aeb0e7ce18e75..008242b1bf477541c369777b00a26a77e6ac22d5 100644
--- a/MAC/GCF/TM/src/PortImpl/GTM_FileHandler.cc
+++ b/MAC/GCF/TM/src/PortImpl/GTM_FileHandler.cc
@@ -27,94 +27,91 @@
 #include "GTM_File.h"
 #include <GCF/TM/GCF_Task.h>
 
-namespace LOFAR 
-{
- namespace GCF 
- {
-  namespace TM 
-  {
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
 GTMFileHandler* GTMFileHandler::_pInstance = 0;
 
 GTMFileHandler* GTMFileHandler::instance()
 {
-  if (0 == _pInstance)
-  {
-    _pInstance = new GTMFileHandler();
-    ASSERT(!_pInstance->mayDeleted());
-  }
-  _pInstance->use();
-  return _pInstance;
+	if (0 == _pInstance) {
+		_pInstance = new GTMFileHandler();
+		ASSERT(!_pInstance->mayDeleted());
+	}
+	_pInstance->use();
+
+	return _pInstance;
 }
 
 void GTMFileHandler::release()
 {
-  ASSERT(_pInstance);
-  ASSERT(!_pInstance->mayDeleted());
-  _pInstance->leave(); 
-  if (_pInstance->mayDeleted())
-  {
-    delete _pInstance;
-    ASSERT(!_pInstance);
-  }
+	ASSERT(_pInstance);
+	ASSERT(!_pInstance->mayDeleted());
+	_pInstance->leave(); 
+	if (_pInstance->mayDeleted()) {
+		delete _pInstance;
+		ASSERT(!_pInstance);
+	}
 }
 
-GTMFileHandler::GTMFileHandler() : _running(true)
+GTMFileHandler::GTMFileHandler() : 
+	_running(true)
 {
-  FD_ZERO(&_readFDs);
+	FD_ZERO(&_readFDs);
 }
 
 void GTMFileHandler::registerFile(GTMFile& file)
 {
-  FD_SET(file.getFD(), &_readFDs);
-  _files[file.getFD()] = &file;
+	LOG_TRACE_OBJ_STR("Adding filedescriptor " << file.getFD());
+	FD_SET(file.getFD(), &_readFDs);
+	_files[file.getFD()] = &file;
 }
 
 void GTMFileHandler::deregisterFile(GTMFile& file)
 {
-  FD_CLR(file.getFD(), &_readFDs);
-  _files.erase(file.getFD());  
+	LOG_TRACE_OBJ_STR("Removing filedescriptor " << file.getFD());
+	FD_CLR(file.getFD(), &_readFDs);
+	_files.erase(file.getFD());  
 }
 
 void GTMFileHandler::workProc()
 {
-  int result;
-  int fd;
-  TFiles testFiles;
+	int				result;
+	int				fd;
+	TFiles 			testFiles;
+	struct timeval	select_timeout;
 
-  struct timeval select_timeout;
+	//
+	// because select call changes the timeout value to
+	// contain the remaining time we need to set it to 10ms
+	// on every call to workProc
+	// 
+	select_timeout.tv_sec  = 0;
+	select_timeout.tv_usec = 10000;
 
-  //
-  // because select call changes the timeout value to
-  // contain the remaining time we need to set it to 10ms
-  // on every call to workProc
-  // 
-  select_timeout.tv_sec  = 0;
-  select_timeout.tv_usec = 10000;
-    
-  _running = true;
-  fd_set testFDs;
-  testFDs = _readFDs;
-  testFiles.insert(_files.begin(), _files.end());
-  result = ::select(FD_SETSIZE, &testFDs, (fd_set *) 0, (fd_set *) 0, &select_timeout);
+	_running = true;
+	fd_set testFDs;
+	testFDs = _readFDs;
+	testFiles.insert(_files.begin(), _files.end());
+	result = ::select(FD_SETSIZE, &testFDs, (fd_set *) 0, (fd_set *) 0, &select_timeout);
+	if (_files.empty()) {
+		return;
+	}
 
-  if (_files.empty()) return;
-  
-  if (result >= 0)
-  {
-    for (fd = 0; fd < FD_SETSIZE && _running; fd++)
-    {
-      if (FD_ISSET(fd, &testFDs))
-      {
-        testFiles[fd]->workProc();
-      }
-    }
-  }
+	if (result >= 0) {
+		for (fd = 0; fd < FD_SETSIZE && _running; fd++) {
+			if (FD_ISSET(fd, &testFDs)) {
+				testFiles[fd]->doWork();
+			}
+		}
+	}
 }
 
 void GTMFileHandler::stop()
 {
-  _running = false;
+	_running = false;
 }
+
   } // namespace TM
  } // namespace GCF
 } // namespace LOFAR
diff --git a/MAC/GCF/TM/src/PortImpl/GTM_FileHandler.h b/MAC/GCF/TM/src/PortImpl/GTM_FileHandler.h
index 9e8eacff855d15f879bdf3f486aa8182705c357b..130c3c9401f2febd766d307dff2b3ce2d751566e 100644
--- a/MAC/GCF/TM/src/PortImpl/GTM_FileHandler.h
+++ b/MAC/GCF/TM/src/PortImpl/GTM_FileHandler.h
@@ -43,27 +43,30 @@ class GTMFile;
  */
 class GTMFileHandler : public GCFHandler
 {
-  public: // constructors, destructors and default operators
+public: 
+	// constructors, destructors and default operators
     virtual ~GTMFileHandler () { _pInstance = 0;}
-  
-  private:
-    friend class GTMFile; // is not necessary but suppress a warning, which we can accept
-    GTMFileHandler ();
-    /// Don't allow copying of the GTMTimerHandler object.
-    GTMFileHandler (const GTMFileHandler&);
-    GTMFileHandler& operator= (const GTMFileHandler&);
 
-  public: // GTMFileHandler specific member methods
+	// GTMFileHandler specific member methods
     /// singleton pattern methods
     static GTMFileHandler* instance ();
     static void release ();
 
     void workProc (); /// part of the mainloop
     void stop ();
-    void registerFile (GTMFile& timer);
-    void deregisterFile (GTMFile& timer); 
+    void registerFile (GTMFile& file);
+    void deregisterFile (GTMFile& file); 
+
+  
+private:
+    friend class GTMFile; // is not necessary but suppress a warning, which we can accept
+
+    GTMFileHandler ();
+    /// Don't allow copying of the GTMTimerHandler object.
+    GTMFileHandler (const GTMFileHandler&);
+    GTMFileHandler& operator= (const GTMFileHandler&);
 
-  private:
+	// ----- Data Members -----
     static GTMFileHandler* _pInstance; // singleton pointer
 
     /// all registered "files"
diff --git a/MAC/GCF/TM/src/PortImpl/GTM_TCPServerSocket.cc b/MAC/GCF/TM/src/PortImpl/GTM_TCPServerSocket.cc
index 894741572d97b407edca2ba2b9cfc1696566db6f..4dad7878664bb2a654a69a1f3abf2c523f53fcdc 100644
--- a/MAC/GCF/TM/src/PortImpl/GTM_TCPServerSocket.cc
+++ b/MAC/GCF/TM/src/PortImpl/GTM_TCPServerSocket.cc
@@ -40,15 +40,15 @@ namespace LOFAR {
   namespace TM {
     
 GTMTCPServerSocket::GTMTCPServerSocket(GCFTCPPort& port, bool isProvider) : 
-  GTMTCPSocket(port),
-  _isProvider(isProvider),
-  _pDataSocket(0)
+	GTMTCPSocket(port),
+	_isProvider(isProvider),
+	_pDataSocket(0)
 {
 }
 
 GTMTCPServerSocket::~GTMTCPServerSocket()
 {
-  close();  
+	close();  
 }
 
 bool GTMTCPServerSocket::open(unsigned int portNumber)
@@ -110,102 +110,112 @@ bool GTMTCPServerSocket::open(unsigned int portNumber)
 	return (true);
 }
 
-void GTMTCPServerSocket::workProc()
+//
+// doWork()
+//
+// Called by the GTM_FileHandler when 'select' returned an event on this fd.
+//
+void GTMTCPServerSocket::doWork()
 {
-  if (_isProvider) {
-    GCFEvent acceptReqEvent(F_ACCEPT_REQ);
-    dispatch(acceptReqEvent);
-  }
-  else {
-    GCFTCPPort* pPort = (GCFTCPPort*)(&_port);
-
-    ASSERT(_pDataSocket == 0);
-    _pDataSocket = new GTMTCPSocket(*pPort);
-    ASSERT (_pDataSocket->getFD() < 0);
-
-    struct sockaddr_in clientAddress;
-    socklen_t clAddrLen = sizeof(clientAddress);
-    int newSocketFD;
-
-    /* loop to handle transient errors */
-    int retries = MAX_ACCEPT_RETRIES;
-    while ((newSocketFD = ::accept(_fd, 
-			   (struct sockaddr*) &clientAddress,
-				   &clAddrLen)) < 0
-	   && (EINTR == errno || EWOULDBLOCK == errno || EAGAIN == errno)
-	   && --retries > 0) /*noop*/;
-
-    _pDataSocket->setFD(newSocketFD);
-         
-    if (_pDataSocket->getFD() >= 0) {
-      GCFEvent connectedEvent(F_CONNECTED);
-      dispatch(connectedEvent);
-    }
-    else {
-      LOG_WARN(formatString ( "::accept, error: %s", strerror(errno)));
-    }
-    
-    // because we only accept one connection (SPP), we don't need to listen with
-    // this socket anymore
-    GTMFile::close();
-  }
+	LOG_TRACE_FLOW("GTMTCPServerSocket::doWork()");
+
+	if (_isProvider) {
+		GCFEvent acceptReqEvent(F_ACCEPT_REQ);
+		forwardEvent(acceptReqEvent);
+	}
+	else {
+		GCFTCPPort* pPort = (GCFTCPPort*)(&_port);
+
+		ASSERT(_pDataSocket == 0);
+		_pDataSocket = new GTMTCPSocket(*pPort);
+		ASSERT (_pDataSocket->getFD() < 0);
+
+		struct sockaddr_in clientAddress;
+		socklen_t clAddrLen = sizeof(clientAddress);
+		int newSocketFD;
+
+		/* loop to handle transient errors */
+		int retries = MAX_ACCEPT_RETRIES;
+		while ((newSocketFD = ::accept(_fd, (struct sockaddr*) &clientAddress, &clAddrLen)) < 0
+			&& (EINTR == errno || EWOULDBLOCK == errno || EAGAIN == errno) && --retries > 0) 
+			/*noop*/;
+
+		_pDataSocket->setFD(newSocketFD);
+
+		if (_pDataSocket->getFD() >= 0) {
+			GCFEvent connectedEvent(F_CONNECTED);
+			forwardEvent(connectedEvent);
+		}
+		else {
+			LOG_WARN(formatString ( "::accept, error: %s", strerror(errno)));
+		}
+
+		// because we only accept one connection (SPP), we don't need to listen with
+		// this socket anymore
+		GTMFile::close();
+	}
 }
 
+//
+// accept(newsocket)
+//
+// Called by the usercode after getting an F_ACCEPT_REQ
+//
 bool GTMTCPServerSocket::accept(GTMFile& newSocket)
 {
-  bool result(false);
-  if (_isProvider && _pDataSocket == 0) {
-    struct sockaddr_in clientAddress;
-    socklen_t clAddrLen = sizeof(clientAddress);
-    int newSocketFD;
-
-    /* loop to handle transient errors */
-    int retries = MAX_ACCEPT_RETRIES;
-    while ((newSocketFD = ::accept(_fd, 
-                       (struct sockaddr*) &clientAddress, 
-				   &clAddrLen)) < 0
-	   && (EINTR == errno || EWOULDBLOCK == errno || EAGAIN == errno)
-	   && --retries > 0) /*noop*/;
-    
-    result = (newSocket.setFD(newSocketFD) > 0);
-    if (!result) {
-      LOG_WARN(formatString ("::accept, error: %s", strerror(errno)));
-    }
-  }
-  
-  return result;
+	bool result(false);
+	if (_isProvider && _pDataSocket == 0) {
+		struct sockaddr_in clientAddress;
+		socklen_t clAddrLen = sizeof(clientAddress);
+		int newSocketFD;
+
+		/* loop to handle transient errors */
+		int retries = MAX_ACCEPT_RETRIES;
+		while ((newSocketFD = ::accept(_fd, (struct sockaddr*) &clientAddress, &clAddrLen)) < 0
+			&& (EINTR == errno || EWOULDBLOCK == errno || EAGAIN == errno) && --retries > 0) 
+			/*noop*/;
+
+		result = (newSocket.setFD(newSocketFD) > 0);
+		if (!result) {
+			LOG_WARN(formatString ("::accept, error: %s", strerror(errno)));
+		}
+	}
+
+	return result;
 }
 
 bool GTMTCPServerSocket::close()
 {
-  bool result(true);
-  
-  if (!_isProvider && _pDataSocket != 0) {
-    result = _pDataSocket->close();
-    delete _pDataSocket;
-    _pDataSocket = 0;
-  }
-  if (result)
-    result = GTMFile::close();
-    
-  return result;
+	bool result(true);
+
+	if (!_isProvider && _pDataSocket != 0) {
+		result = _pDataSocket->close();
+		delete _pDataSocket;
+		_pDataSocket = 0;
+	}
+	if (result) {
+		result = GTMFile::close();
+	}
+
+	return result;
 }
 
 ssize_t GTMTCPServerSocket::send(void* buf, size_t count)
 {
-  if (!_isProvider && _pDataSocket != 0) 
-    return _pDataSocket->send(buf, count);
-  else
-    return 0;
+	if (!_isProvider && _pDataSocket != 0) {
+		return _pDataSocket->send(buf, count);
+	}
+	return 0;
 }
 
-ssize_t GTMTCPServerSocket::recv(void* buf, size_t count)
+ssize_t GTMTCPServerSocket::recv(void* buf, size_t count, bool  raw)
 {
-  if (!_isProvider && _pDataSocket != 0) 
-    return _pDataSocket->recv(buf, count);
-  else
-    return 0;
+	if (!_isProvider && _pDataSocket != 0) {
+		return _pDataSocket->recv(buf, count, raw);
+	}
+	return 0;
 }
+
   } // namespace TM
  } // namespace GCF
 } // namespace LOFAR
diff --git a/MAC/GCF/TM/src/PortImpl/GTM_TCPServerSocket.h b/MAC/GCF/TM/src/PortImpl/GTM_TCPServerSocket.h
index 58db668299a418d828f17a30d5999546911d2cd7..fc3f1c057099a60c5feab4b2a310daef6facb3a6 100644
--- a/MAC/GCF/TM/src/PortImpl/GTM_TCPServerSocket.h
+++ b/MAC/GCF/TM/src/PortImpl/GTM_TCPServerSocket.h
@@ -25,12 +25,9 @@
 
 #include "GTM_TCPSocket.h"
 
-namespace LOFAR 
-{
- namespace GCF 
- {
-  namespace TM 
-  {
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
 
 // forward declaration
 
@@ -42,37 +39,33 @@ namespace LOFAR
  */
 class GTMTCPServerSocket : public GTMTCPSocket
 {
-  public: // constructors, destructors and default operators
+public: 
+	// constructors, destructors and default operators
     GTMTCPServerSocket (GCFTCPPort& port, 
                         bool isProvider = false);
-  
     virtual ~GTMTCPServerSocket ();
   
-  private:
-    GTMTCPServerSocket();
-    /// Don't allow copying of the GTMTCPServerSocket object.
-    GTMTCPServerSocket (const GTMTCPServerSocket&);
-    GTMTCPServerSocket& operator= (const GTMTCPServerSocket&);
-
-  public: // GTMTCPServerSocket specific member methods
-    /**
-     * open/close methods
-     */
+	// GTMTCPServerSocket specific member methods
+    // open/close methods
     virtual bool open (unsigned int portNumber);
     virtual bool close ();
     bool accept (GTMFile& newSocket);
     
-    /**
-     * send/recv methods
-     */
+    // send/recv methods
     virtual ssize_t send (void* buf, size_t count);
-    virtual ssize_t recv (void* buf, size_t count);
+    virtual ssize_t recv (void* buf, size_t count, bool raw = false);
+
+private:
+    GTMTCPServerSocket();
+    /// Don't allow copying of the GTMTCPServerSocket object.
+    GTMTCPServerSocket (const GTMTCPServerSocket&);
+    GTMTCPServerSocket& operator= (const GTMTCPServerSocket&);
 
-  protected:
-    virtual void workProc ();
+protected:
+    virtual void doWork();
     
-    bool _isProvider;
-    GTMTCPSocket* _pDataSocket;
+    bool 			_isProvider;
+    GTMTCPSocket*	_pDataSocket;
 };
 
   } // namespace TM
diff --git a/MAC/GCF/TM/src/PortImpl/GTM_TCPSocket.cc b/MAC/GCF/TM/src/PortImpl/GTM_TCPSocket.cc
index bb928b4537c6ff89c543849fdb983e3eac76fb94..af1df88f427b756da126c849a6ebee7656692787 100644
--- a/MAC/GCF/TM/src/PortImpl/GTM_TCPSocket.cc
+++ b/MAC/GCF/TM/src/PortImpl/GTM_TCPSocket.cc
@@ -84,9 +84,9 @@ ssize_t GTMTCPSocket::send(void* buf, size_t count)
 }
 
 //
-// recv(buf, count)
+// recv(buf, count, raw)
 //
-ssize_t GTMTCPSocket::recv(void* buf, size_t count)
+ssize_t GTMTCPSocket::recv(void* buf, size_t count, bool raw)
 {
 	if (_fd < 0) {
 		LOG_WARN("recv, error: Socket not opend");
@@ -110,9 +110,9 @@ ssize_t GTMTCPSocket::recv(void* buf, size_t count)
 		else {
 			countLeft -= received;
 		}      
-	} while (countLeft > 0);
+	} while (!raw && (countLeft > 0));
 
-	return count;
+	return (count - countLeft);
 }
 
 //
diff --git a/MAC/GCF/TM/src/PortImpl/GTM_TCPSocket.h b/MAC/GCF/TM/src/PortImpl/GTM_TCPSocket.h
index ab992cce9fefad5f022fca91c0c766d1e3a370d1..55003b837767ec3c585a090de422ccce8218e054 100644
--- a/MAC/GCF/TM/src/PortImpl/GTM_TCPSocket.h
+++ b/MAC/GCF/TM/src/PortImpl/GTM_TCPSocket.h
@@ -26,12 +26,9 @@
 #include "GTM_File.h"
 #include <Common/lofar_string.h>
 
-namespace LOFAR 
-{
- namespace GCF 
- {
-  namespace TM 
-  {
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
 
 // forward declaration
 class GCFTCPPort;
@@ -43,31 +40,26 @@ class GCFTCPPort;
 
 class GTMTCPSocket : public GTMFile
 {
-  public: // constructors, destructors and default operators
+public: 
+	// constructors, destructors and default operators
     GTMTCPSocket (GCFTCPPort& port);
     virtual ~GTMTCPSocket ();
   
-  private:
-    GTMTCPSocket ();
-    /// Don't allow copying of the GTMTCPSocket object.
-    GTMTCPSocket (const GTMTCPSocket&);
-    GTMTCPSocket& operator= (const GTMTCPSocket&);
-
-  
-  public: // GTMTCPSocket specific member methods
-    /**
-     * open/close methods
-     */
+	// GTMTCPSocket specific member methods
+    // open/close methods
     virtual bool open (unsigned int portNumber);
     virtual bool connect (unsigned int portNumber, const string& host);
   
-    /**
-     * send/recv methods
-     */
+    // send/recv methods
     virtual ssize_t send (void* buf, size_t count);
-    virtual ssize_t recv (void* buf, size_t count);
+    virtual ssize_t recv (void* buf, size_t count, bool raw = false);
+
+private:
+    GTMTCPSocket ();
+    /// Don't allow copying of the GTMTCPSocket object.
+    GTMTCPSocket (const GTMTCPSocket&);
+    GTMTCPSocket& operator= (const GTMTCPSocket&);
 
-  protected: // data member
 };
 
   } // namespace TM
diff --git a/MAC/GCF/TM/src/ServiceBroker/GTM_SBTCPPort.cc b/MAC/GCF/TM/src/ServiceBroker/GTM_SBTCPPort.cc
index cc414f1ef903ef2ab13e37b60fdbe46f92d6eda8..11fbdfc7a1db3aff4f12a07f592fe08db77b518a 100644
--- a/MAC/GCF/TM/src/ServiceBroker/GTM_SBTCPPort.cc
+++ b/MAC/GCF/TM/src/ServiceBroker/GTM_SBTCPPort.cc
@@ -73,15 +73,13 @@ GTMSBTCPPort::~GTMSBTCPPort()
 bool GTMSBTCPPort::open()
 {
 	if (isConnected()) {
-		LOG_ERROR(formatString ("Port %s already open.", 
-								makeServiceName().c_str()));
+		LOG_ERROR(formatString ("Port %s already open.", makeServiceName().c_str()));
 		return false;
 	}
 
 	if (!_pSocket) {
 		if (isSlave()) {
-			LOG_ERROR(formatString ("Port %s not initialised.", 
-									makeServiceName().c_str()));
+			LOG_ERROR(formatString ("Port %s not initialised.", makeServiceName().c_str()));
 			return false;
 		}
 
diff --git a/MAC/GCF/TM/src/ServiceBroker/GTM_SBTCPPort.h b/MAC/GCF/TM/src/ServiceBroker/GTM_SBTCPPort.h
index 4b10b4dba64e6ffdb891585204291f1cb8421c29..0f589388c7f74c986d3be7500a4a42470cbfd941 100644
--- a/MAC/GCF/TM/src/ServiceBroker/GTM_SBTCPPort.h
+++ b/MAC/GCF/TM/src/ServiceBroker/GTM_SBTCPPort.h
@@ -25,12 +25,9 @@
 
 #include <GCF/TM/GCF_TCPPort.h>
 
-namespace LOFAR 
-{
- namespace GCF 
- {
-  namespace SB 
-  {
+namespace LOFAR {
+ namespace GCF {
+  namespace SB {
 
 // forward declaration
 
diff --git a/MAC/GCF/TM/src/ServiceBroker/ServiceBrokerTask.cc b/MAC/GCF/TM/src/ServiceBroker/ServiceBrokerTask.cc
index 205a7601310d32333cca3f82e376fa464739ff45..16462726a82bdb5bae969562b4f86de5b6b3ae1c 100644
--- a/MAC/GCF/TM/src/ServiceBroker/ServiceBrokerTask.cc
+++ b/MAC/GCF/TM/src/ServiceBroker/ServiceBrokerTask.cc
@@ -81,7 +81,7 @@ ServiceBrokerTask* ServiceBrokerTask::instance(bool temporary)
 		GTMSBHandler::_pInstance->use();
 	}
 
-	return &GTMSBHandler::_pInstance->_controller;
+	return (&GTMSBHandler::_pInstance->_controller);
 }
 
 //
@@ -267,7 +267,7 @@ void ServiceBrokerTask::_logResult(uint16	 	result,
 		break;
 
 		case SB_UNKNOWN_SERVICE:
-			LOG_FATAL_STR("Unknown remote service: "<< servicename << "@" << hostname);
+			LOG_WARN_STR("Unknown remote service: "<< servicename << "@" << hostname);
 		break;
 
 		case SB_NO_CONNECTION:
@@ -332,6 +332,7 @@ void ServiceBrokerTask::_doActionList(const string&	hostname)
 	if (itsActionList.empty()) {
 		return;
 	}
+	_printActionList();
 
 	// Note: while processing the list, the list grows. Therefore we use actionsLeft.
 	ALiter		end  = itsActionList.end();
@@ -430,17 +431,44 @@ void ServiceBrokerTask::_reconnectBrokers()
 //	}
 }
 
+//
+// _printActionList
+//
+void ServiceBrokerTask::_printActionList()
+{
+	if (itsActionList.empty()) {
+		return;
+	}
+
+	ALiter	end  = itsActionList.end();
+	ALiter	iter = itsActionList.begin();
+	string	typeName;
+	LOG_TRACE_FLOW_STR("ActionList at " << time(0));
+	while (iter != end) {
+		switch (iter->type) {
+		case SB_REGISTER_SERVICE:	typeName = "Register";		break;
+		case SB_UNREGISTER_SERVICE: typeName = "Unregister";	break;
+		case SB_GET_SERVICEINFO: 	typeName = "ServiceInfo";	break;
+		default:					typeName = "???";			break;
+		}
+
+		LOG_DEBUG_STR(typeName << " " << iter->servicename << "@" << iter->hostname << 
+						"(" << iter->timestamp << ")");
+		++iter;
+	}
+}
+
 //
 // _checkActionList(hostname);
 //
 void ServiceBrokerTask::_checkActionList(const string&	hostname)
 {
 	LOG_TRACE_FLOW_STR("_checkActionList(" << hostname <<")");
+	_printActionList();
 
 	ALiter	end  = itsActionList.end();
 	ALiter	iter = itsActionList.begin();
 	time_t	currentTime = time(0);
-
 	// check for which actions we are late.
 	while (iter != end) {
 		if (iter->hostname == hostname && currentTime > iter->timestamp+itsMaxResponse) {
diff --git a/MAC/GCF/TM/src/ServiceBroker/ServiceBrokerTask.h b/MAC/GCF/TM/src/ServiceBroker/ServiceBrokerTask.h
index 32a93a2ecd87cb1df820e0fe0687bfdffce971e0..88f888100c86941d56f309f0c3a6e06834dd2126 100644
--- a/MAC/GCF/TM/src/ServiceBroker/ServiceBrokerTask.h
+++ b/MAC/GCF/TM/src/ServiceBroker/ServiceBrokerTask.h
@@ -28,20 +28,27 @@
 #include <Common/lofar_list.h>
 #include <MACIO/GCF_Event.h>
 #include <GCF/TM/GCF_Task.h>
-#include "GTM_SBTCPPort.h"
 #include <GCF/TM/GCF_Handler.h>
+#include <GCF/TM/GCF_TCPPort.h>
+#include <GCF/TM/GCF_TimerPort.h>
+#include "GTM_SBTCPPort.h"
 
 namespace LOFAR {
- using MACIO::GCFEvent;
- namespace GCF {  
-  namespace SB {
+  using MACIO::GCFEvent;
+  namespace GCF {
+	using TM::GCFPortInterface;
+	using TM::GCFTCPPort;
+	using TM::GCFTimerPort;
+	using TM::GCFTask;
+	using TM::GCFHandler;
+	namespace SB {
 
 /**
 */
 
 class GTMSBHandler;
 
-class ServiceBrokerTask : public TM::GCFTask
+class ServiceBrokerTask : public GCFTask
 {
 public:
     ~ServiceBrokerTask ();
@@ -49,25 +56,25 @@ public:
     static void release();
 
 	// member functions
-    void registerService  (TM::GCFTCPPort&	servicePort);
-    void unregisterService(TM::GCFTCPPort&	servicePort);
-    void getServiceinfo   (TM::GCFTCPPort&	clientPort, 
+    void registerService  (GCFTCPPort&	servicePort);
+    void unregisterService(GCFTCPPort&	servicePort);
+    void getServiceinfo   (GCFTCPPort&	clientPort, 
 						   const string& 	remoteServiceName,
 						   const string&	hostname);
-    void deletePort		  (TM::GCFTCPPort&	port);
+    void deletePort		  (GCFTCPPort&	port);
   
 private:
     friend class GTMSBHandler;
     ServiceBrokerTask ();
 
 	// state methods
-    GCFEvent::TResult operational (GCFEvent& e, TM::GCFPortInterface& p);
+    GCFEvent::TResult operational (GCFEvent& e, GCFPortInterface& p);
         
 	// helper structures and classes
     typedef struct action_t {
 		uint16				seqnr;
 		uint16 				type;
-		TM::GCFTCPPort*		pPort;
+		GCFTCPPort*		pPort;
 		string 				servicename;
 		string				hostname;
 		time_t				timestamp;
@@ -100,6 +107,7 @@ private:
 	void	_deleteService     (GCFTCPPort&			aPort);
     uint16	_registerAction    (Action 				action);
 	void	_doActionList	   (const string&		hostname);
+	void	_printActionList   ();
 	ALiter	_findAction		   (uint16				seqnr);
 	BMiter	_getBroker		   (const string&		hostname);
 	void	_reconnectBrokers  ();
@@ -120,7 +128,7 @@ private:
 
 };
 
-class GTMSBHandler : public TM::GCFHandler
+class GTMSBHandler : public GCFHandler
 {
 public:
     ~GTMSBHandler() { _pInstance = 0; }
diff --git a/MAC/GCF/TM/src/Timer/GTM_Timer.cc b/MAC/GCF/TM/src/Timer/GTM_Timer.cc
index 01ed3aa6e4950eefb1f9f94787306010735faf9e..8438ee9aa258c587e5a7130a29eb6852658d36b6 100644
--- a/MAC/GCF/TM/src/Timer/GTM_Timer.cc
+++ b/MAC/GCF/TM/src/Timer/GTM_Timer.cc
@@ -30,7 +30,7 @@
 #include <Timer/GTM_Timer.h>
 #include <GCF/TM/GCF_RawPort.h>
 #include <GCF/TM/GCF_Protocols.h>
-#include <GTM_Defines.h>
+#include <GCF/TM/GCF_Scheduler.h>
 
 namespace LOFAR 
 {
@@ -71,7 +71,7 @@ void GTMTimer::decreaseTime()
 	te.usec = now.tv_usec;
 	te.id   = _id;
 	te.arg  = _arg;
-	_port.dispatch(te);
+	GCFScheduler::instance()->queueEvent(0, te, &_port);
 
 	if (_intervalTime == 0) {
 		_elapsed = true;
diff --git a/MAC/GCF/TM/src/Timer/GTM_TimerHandler.cc b/MAC/GCF/TM/src/Timer/GTM_TimerHandler.cc
index b0a8d0248916a381fcbf5daa4d4928f64d0e84ba..ba6bcd304518d7ea041720a1d1581a93a52fc08b 100644
--- a/MAC/GCF/TM/src/Timer/GTM_TimerHandler.cc
+++ b/MAC/GCF/TM/src/Timer/GTM_TimerHandler.cc
@@ -29,19 +29,15 @@
 #include <Timer/GTM_Timer.h>
 #include <GCF/TM/GCF_Task.h>
 
-namespace LOFAR 
-{
- namespace GCF 
- {
-  namespace TM 
-  {
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
 
 GTMTimerHandler* GTMTimerHandler::_pInstance = 0;
 
 GTMTimerHandler* GTMTimerHandler::instance()
 {
-  if (0 == _pInstance)
-  {
+  if (0 == _pInstance) {
     _pInstance = new GTMTimerHandler();
     ASSERT(!_pInstance->mayDeleted());
   }
@@ -54,8 +50,7 @@ void GTMTimerHandler::release()
   ASSERT(_pInstance);
   ASSERT(!_pInstance->mayDeleted());
   _pInstance->leave(); 
-  if (_pInstance->mayDeleted())
-  {
+  if (_pInstance->mayDeleted()) {
     delete _pInstance;
     ASSERT(!_pInstance);
   }
@@ -69,9 +64,7 @@ GTMTimerHandler::GTMTimerHandler() :
 GTMTimerHandler::~GTMTimerHandler()
 { 
   GTMTimer* pCurTimer(0);
-  for (TTimers::iterator iter = _timers.begin(); 
-       iter != _timers.end(); ++iter)
-  {
+  for (TTimers::iterator iter = _timers.begin(); iter != _timers.end(); ++iter) {
     pCurTimer = iter->second;
     ASSERT(pCurTimer);
     delete pCurTimer;
@@ -92,18 +85,14 @@ void GTMTimerHandler::workProc()
   TTimers tempTimers;
   tempTimers.insert(_timers.begin(), _timers.end());
     
-  for (TTimers::iterator iter = tempTimers.begin(); 
-       iter != tempTimers.end() && _running; ++iter)
-  {
+  for (TTimers::iterator iter = tempTimers.begin(); iter != tempTimers.end() && _running; ++iter) {
     pCurTimer = iter->second;
     ASSERT(pCurTimer);
-    if (pCurTimer->isElapsed() || pCurTimer->isCanceled())
-    {
+    if (pCurTimer->isElapsed() || pCurTimer->isCanceled()) {
       delete pCurTimer;
       _timers.erase(iter->first);
     }
-    else
-    {
+    else {
       pCurTimer->decreaseTime();	// and dispatch F_TIMER when elapsed
     }
   }
@@ -118,8 +107,7 @@ unsigned long GTMTimerHandler::setTimer(GCFRawPort& port,
 
   // search the first unused timerid
   TTimers::iterator iter;
-  do 
-  {
+  do {
     timerid++;
     iter = _timers.find(timerid);
   }
@@ -140,14 +128,19 @@ int GTMTimerHandler::cancelTimer(unsigned long timerid, void** arg)
   int result(0);
   GTMTimer* pCurTimer(0);
   TTimers::iterator iter = _timers.find(timerid);
-  if (arg) *arg = 0;
-  if (iter == _timers.end())
+  if (arg) {
+	*arg = 0;
+  }
+  if (iter == _timers.end()) {
     return result;
+  }
   pCurTimer = iter->second;
 
   ASSERT(pCurTimer);
   result = 1;
-  if (arg) *arg = pCurTimer->getTimerArg();
+  if (arg) {
+	*arg = pCurTimer->getTimerArg();
+  }
   pCurTimer->cancel();
   
   return result;
@@ -158,13 +151,10 @@ int GTMTimerHandler::cancelAllTimers(GCFRawPort& port)
   int result(0);
   GTMTimer* pCurTimer(0);
   
-  for (TTimers::iterator iter = _timers.begin(); 
-       iter != _timers.end(); ++iter)
-  {
+  for (TTimers::iterator iter = _timers.begin(); iter != _timers.end(); ++iter) {
     pCurTimer = iter->second;
     ASSERT(pCurTimer);
-    if (&(pCurTimer->getPort()) == &port)
-    {  
+    if (&(pCurTimer->getPort()) == &port) {  
       pCurTimer->cancel();
       result++;
     }
diff --git a/MAC/GCF/TM/src/Timer/GTM_TimerHandler.h b/MAC/GCF/TM/src/Timer/GTM_TimerHandler.h
index 46e53c9f63d834ab827a189c22ad8bf08151260f..13d4a6d41966eb44228d14f009be3aee59bef328 100644
--- a/MAC/GCF/TM/src/Timer/GTM_TimerHandler.h
+++ b/MAC/GCF/TM/src/Timer/GTM_TimerHandler.h
@@ -23,14 +23,12 @@
 #ifndef GTM_TIMERHANDLER_H
 #define GTM_TIMERHANDLER_H
 
+#include <Common/lofar_map.h>
 #include <GCF/TM/GCF_Handler.h>
 
-namespace LOFAR 
-{
- namespace GCF 
- {
-  namespace TM 
-  {
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
 
 class GTMTimer;
 class GCFRawPort;
@@ -64,9 +62,7 @@ class GTMTimerHandler : GCFHandler
     GTMTimerHandler ();
     static GTMTimerHandler* _pInstance;
 
-    /**
-     * Don't allow copying of the GTMTimerHandler object.
-     */
+    // Don't allow copying of the GTMTimerHandler object.
     GTMTimerHandler (const GTMTimerHandler&);
     GTMTimerHandler& operator= (const GTMTimerHandler&);
     
diff --git a/MAC/GCF/TM/test/Echo.cc b/MAC/GCF/TM/test/Echo.cc
index 38cf27a13e5e14291fdee271f34d425db6091c6a..f6ba7196a3b1db991ffcb0c5942b910b15ea8071 100644
--- a/MAC/GCF/TM/test/Echo.cc
+++ b/MAC/GCF/TM/test/Echo.cc
@@ -22,9 +22,9 @@
 //  $Id$
 
 #include <lofar_config.h>
-#include "Echo.h"
+#include <Common/LofarLogger.h>
 #include "Echo_Protocol.ph"
-#include <Common/lofar_iostream.h>
+#include "Echo.h"
 
 static 	int		gDelay = 0;
 static	timeval	gTime;
@@ -40,11 +40,13 @@ Echo::Echo(string name) : GCFTask((State)&Echo::initial, name)
   registerProtocol(ECHO_PROTOCOL, ECHO_PROTOCOL_STRINGS);
 
   // initialize the port
-  server.init(*this, "EchoServer", GCFPortInterface::SPP, ECHO_PROTOCOL);
+  server = new GCFTCPPort(*this, "EchoServer:test", GCFPortInterface::MSPP, ECHO_PROTOCOL);
 }
 
 GCFEvent::TResult Echo::initial(GCFEvent& e, GCFPortInterface& /*p*/)
 {
+	LOG_DEBUG_STR("Echo::initial: " << eventName(e));
+
   GCFEvent::TResult status = GCFEvent::HANDLED;
 
 	switch (e.signal) {
@@ -52,24 +54,17 @@ GCFEvent::TResult Echo::initial(GCFEvent& e, GCFPortInterface& /*p*/)
 		break;
 
     case F_ENTRY:
-    case F_TIMER:
-		if (!server.isConnected())
-			server.open();
+		server->open();
 		break;
 
     case F_CONNECTED:
-		if (server.isConnected()) {
+		if (server->isConnected()) {
 			TRAN(Echo::connected);
 		}
 		break;
 
-    case F_DISCONNECTED:
-		if (!server.isConnected()) {
-			server.setTimer(1.0); // try again after 1 second
-		}
-		break;
-
     default:
+		LOG_DEBUG_STR("$$$ DEFAULT at initial of " << eventName(e));
 		status = GCFEvent::NOT_HANDLED;
 		break;
 	}
@@ -79,9 +74,19 @@ GCFEvent::TResult Echo::initial(GCFEvent& e, GCFPortInterface& /*p*/)
 
 GCFEvent::TResult Echo::connected(GCFEvent& e, GCFPortInterface& p)
 {
+	LOG_DEBUG_STR("Echo::connected: " << eventName(e));
+
 	GCFEvent::TResult status = GCFEvent::HANDLED;
 
 	switch (e.signal) {
+	case F_ACCEPT_REQ: {
+		GCFTCPPort*		clientSock = new GCFTCPPort();
+		clientSock->init(*this, "clientSock", GCFPortInterface::SPP, ECHO_PROTOCOL);
+		ASSERTSTR(clientSock, "Blerk");
+		server->accept(*clientSock);
+		break;
+	}
+
 	case F_DISCONNECTED:
 		cout << "Lost connection to client" << endl;
 		p.close();
@@ -101,7 +106,7 @@ GCFEvent::TResult Echo::connected(GCFEvent& e, GCFPortInterface& p)
 		// otherwise an interrupt will be forced by means of setting the pin 9.
 		cout << "PING received (seqnr=" << ping.seqnr << ")" << endl;
 		cout << "delay = " << gDelay << endl;
-		server.setTimer((gDelay < 0) ? -1.0 * gDelay : 1.0 * gDelay);
+		server->setTimer((gDelay < 0) ? -1.0 * gDelay : 1.0 * gDelay);
 		gSeqnr = ping.seqnr;
 		gTime  = ping.ping_time;
 		break;
@@ -121,7 +126,7 @@ GCFEvent::TResult Echo::connected(GCFEvent& e, GCFPortInterface& p)
 		echo.ping_time = gTime;
 		echo.echo_time = echo_time;
 
-		server.send(echo);
+		server->send(echo);
 
 		cout << "ECHO sent" << endl;
 		break;
@@ -139,7 +144,11 @@ GCFEvent::TResult Echo::connected(GCFEvent& e, GCFPortInterface& p)
 		break;
 	}
 
+	case F_CONNECTED:
+		break;
+
 	default:
+		LOG_DEBUG_STR("$$$ DEFAULT at connected of " << eventName(e));
 		status = GCFEvent::NOT_HANDLED;
 		break;
 	}
@@ -156,7 +165,7 @@ using namespace std;
 
 int main(int argc, char* argv[])
 {
-	GCFTask::init(argc, argv);
+	GCFScheduler::instance()->init(argc, argv);
 
 	switch (argc) {
 	case 1:		gDelay = 0;
@@ -174,7 +183,7 @@ int main(int argc, char* argv[])
 
 	Echo echo_task("ECHO");
 	echo_task.start(); // make initial transition
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return (0);
 }
diff --git a/MAC/GCF/TM/test/Echo.h b/MAC/GCF/TM/test/Echo.h
index bc73ac0eed930f8976e6dc6cae28bb3dba6acf7f..28720502100bffc47aee26d96740263c243a7e39 100644
--- a/MAC/GCF/TM/test/Echo.h
+++ b/MAC/GCF/TM/test/Echo.h
@@ -27,12 +27,9 @@
 
 #include <GCF/TM/GCF_Control.h>
 
-namespace LOFAR 
-{
- namespace GCF 
- {
-  namespace TM 
-  {
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
 
 /**
  * The Echo task receives ECHO_PING events from the Ping task and
@@ -72,7 +69,7 @@ class Echo : public GCFTask
    * task are received on the server port. And reply events to the Ping task
    * are sent through the server port.
    */
-  GCFPort server;
+  GCFTCPPort* server;
 };
 
   } // namespace TM
diff --git a/MAC/GCF/TM/test/Makefile.am b/MAC/GCF/TM/test/Makefile.am
index 7170bcf67f03efef12cbd3aa8fb8555b15f07916..b361623e4fc5585b53ca1543ef9080d00c86addf 100644
--- a/MAC/GCF/TM/test/Makefile.am
+++ b/MAC/GCF/TM/test/Makefile.am
@@ -6,25 +6,37 @@ SUFFIXES = .ph
 %.cc: %.prot
 	$(AUTOGEN) --writable -L $(datadir)/MACIO $<
 
-check_PROGRAMS 		= tmEcho tmPing tGCFPort tTimer \
+check_PROGRAMS 			= tAutoOpen tEventQueue tStateResult tmEcho tmPing tGCFPort tTimer \
 						tGCFTask1 tGCFTask2 tGCFTask3 tGCFTask4 tGCFTask5
 
-tmEcho_SOURCES 		= $(BUILT_SOURCES) Echo_Protocol.cc Echo.cc Echo.h 
-tmEcho_LDADD		= ../src/libgcftm.la
-tmEcho_DEPENDENCIES	= ../src/libgcftm.la $(LOFAR_DEPEND)
+tmEcho_SOURCES 			= $(BUILT_SOURCES) Echo.cc Echo_Protocol.cc
+tmEcho_LDADD			= ../src/libgcftm.la
+tmEcho_DEPENDENCIES		= ../src/libgcftm.la $(LOFAR_DEPEND)
 
-tmPing_SOURCES 		= $(BUILT_SOURCES) Echo_Protocol.cc Ping.cc Ping.h
-tmPing_LDADD		= ../src/libgcftm.la
-tmPing_DEPENDENCIES	= ../src/libgcftm.la $(LOFAR_DEPEND)
+tmPing_SOURCES 			= $(BUILT_SOURCES) Ping.cc Echo_Protocol.cc
+tmPing_LDADD			= ../src/libgcftm.la
+tmPing_DEPENDENCIES		= ../src/libgcftm.la $(LOFAR_DEPEND)
 
 tGCFPort_SOURCES 		= $(BUILT_SOURCES) Echo_Protocol.cc \
 						  tGCFPort.cc tGCFPort.h 
 tGCFPort_LDADD			= ../src/libgcftm.la
 tGCFPort_DEPENDENCIES	= ../src/libgcftm.la $(LOFAR_DEPEND)
 
-tTimer_SOURCES 		= $(BUILT_SOURCES) tTimer.cc
-tTimer_LDADD		= ../src/libgcftm.la
-tTimer_DEPENDENCIES	= ../src/libgcftm.la tTimer.h $(LOFAR_DEPEND)
+tTimer_SOURCES 			= $(BUILT_SOURCES) tTimer.cc
+tTimer_LDADD			= ../src/libgcftm.la
+tTimer_DEPENDENCIES		= ../src/libgcftm.la tTimer.h $(LOFAR_DEPEND)
+
+tEventQueue_SOURCES 	= $(BUILT_SOURCES) tEventQueue.cc tClient.cc Echo_Protocol.cc
+tEventQueue_LDADD		= ../src/libgcftm.la
+tEventQueue_DEPENDENCIES= ../src/libgcftm.la $(LOFAR_DEPEND)
+
+tAutoOpen_SOURCES 		= $(BUILT_SOURCES) tAutoOpen.cc tServer.cc Echo_Protocol.cc
+tAutoOpen_LDADD			= ../src/libgcftm.la
+tAutoOpen_DEPENDENCIES  = ../src/libgcftm.la $(LOFAR_DEPEND)
+
+tStateResult_SOURCES	 = $(BUILT_SOURCES) tStateResult.cc tServer.cc Echo_Protocol.cc
+tStateResult_LDADD		 = ../src/libgcftm.la
+tStateResult_DEPENDENCIES= ../src/libgcftm.la $(LOFAR_DEPEND)
 
 tGCFTask1_SOURCES 		= $(BUILT_SOURCES) tGCFTask1.cc testTask.cc
 tGCFTask1_LDADD			= ../src/libgcftm.la
diff --git a/MAC/GCF/TM/test/Makefile.in b/MAC/GCF/TM/test/Makefile.in
new file mode 100644
index 0000000000000000000000000000000000000000..1af3453d9e2315eccaa26ba1d7078fc34ced8a59
--- /dev/null
+++ b/MAC/GCF/TM/test/Makefile.in
@@ -0,0 +1,907 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Some common rules.
+SOURCES = $(tAutoOpen_SOURCES) $(tEventQueue_SOURCES) $(tGCFPort_SOURCES) $(tGCFTask1_SOURCES) $(tGCFTask2_SOURCES) $(tGCFTask3_SOURCES) $(tGCFTask4_SOURCES) $(tGCFTask5_SOURCES) $(tStateResult_SOURCES) $(tTimer_SOURCES) $(tmEcho_SOURCES) $(tmPing_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+check_PROGRAMS = tAutoOpen$(EXEEXT) tEventQueue$(EXEEXT) \
+	tStateResult$(EXEEXT) tmEcho$(EXEEXT) tmPing$(EXEEXT) \
+	tGCFPort$(EXEEXT) tTimer$(EXEEXT) tGCFTask1$(EXEEXT) \
+	tGCFTask2$(EXEEXT) tGCFTask3$(EXEEXT) tGCFTask4$(EXEEXT) \
+	tGCFTask5$(EXEEXT)
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(top_srcdir)/Makefile.common
+subdir = test
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/autoconf_share/am_rpm_init.m4 \
+	$(top_srcdir)/autoconf_share/lofar_docxx.m4 \
+	$(top_srcdir)/autoconf_share/lofar_external.m4 \
+	$(top_srcdir)/autoconf_share/lofar_general.m4 \
+	$(top_srcdir)/autoconf_share/lofar_init.m4 \
+	$(top_srcdir)/autoconf_share/lofar_internal.m4 \
+	$(top_srcdir)/autoconf_share/lofar_logger.m4 \
+	$(top_srcdir)/autoconf_share/lofar_qatools.m4 \
+	$(top_srcdir)/autoconf_share/lofar_shmem.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__objects_1 =
+am_tAutoOpen_OBJECTS = $(am__objects_1) tAutoOpen.$(OBJEXT) \
+	tServer.$(OBJEXT) Echo_Protocol.$(OBJEXT)
+tAutoOpen_OBJECTS = $(am_tAutoOpen_OBJECTS)
+am_tEventQueue_OBJECTS = $(am__objects_1) tEventQueue.$(OBJEXT) \
+	tClient.$(OBJEXT) Echo_Protocol.$(OBJEXT)
+tEventQueue_OBJECTS = $(am_tEventQueue_OBJECTS)
+am_tGCFPort_OBJECTS = $(am__objects_1) Echo_Protocol.$(OBJEXT) \
+	tGCFPort.$(OBJEXT)
+tGCFPort_OBJECTS = $(am_tGCFPort_OBJECTS)
+am_tGCFTask1_OBJECTS = $(am__objects_1) tGCFTask1.$(OBJEXT) \
+	testTask.$(OBJEXT)
+tGCFTask1_OBJECTS = $(am_tGCFTask1_OBJECTS)
+am_tGCFTask2_OBJECTS = $(am__objects_1) tGCFTask2.$(OBJEXT) \
+	testTask.$(OBJEXT)
+tGCFTask2_OBJECTS = $(am_tGCFTask2_OBJECTS)
+am_tGCFTask3_OBJECTS = $(am__objects_1) tGCFTask3.$(OBJEXT) \
+	testTask.$(OBJEXT)
+tGCFTask3_OBJECTS = $(am_tGCFTask3_OBJECTS)
+am_tGCFTask4_OBJECTS = $(am__objects_1) tGCFTask4.$(OBJEXT) \
+	testTask.$(OBJEXT)
+tGCFTask4_OBJECTS = $(am_tGCFTask4_OBJECTS)
+am_tGCFTask5_OBJECTS = $(am__objects_1) tGCFTask5.$(OBJEXT) \
+	testTask.$(OBJEXT)
+tGCFTask5_OBJECTS = $(am_tGCFTask5_OBJECTS)
+am_tStateResult_OBJECTS = $(am__objects_1) tStateResult.$(OBJEXT) \
+	tServer.$(OBJEXT) Echo_Protocol.$(OBJEXT)
+tStateResult_OBJECTS = $(am_tStateResult_OBJECTS)
+am_tTimer_OBJECTS = $(am__objects_1) tTimer.$(OBJEXT)
+tTimer_OBJECTS = $(am_tTimer_OBJECTS)
+am_tmEcho_OBJECTS = $(am__objects_1) Echo.$(OBJEXT) \
+	Echo_Protocol.$(OBJEXT)
+tmEcho_OBJECTS = $(am_tmEcho_OBJECTS)
+am_tmPing_OBJECTS = $(am__objects_1) Ping.$(OBJEXT) \
+	Echo_Protocol.$(OBJEXT)
+tmPing_OBJECTS = $(am_tmPing_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(tAutoOpen_SOURCES) $(tEventQueue_SOURCES) \
+	$(tGCFPort_SOURCES) $(tGCFTask1_SOURCES) $(tGCFTask2_SOURCES) \
+	$(tGCFTask3_SOURCES) $(tGCFTask4_SOURCES) $(tGCFTask5_SOURCES) \
+	$(tStateResult_SOURCES) $(tTimer_SOURCES) $(tmEcho_SOURCES) \
+	$(tmPing_SOURCES)
+DIST_SOURCES = $(tAutoOpen_SOURCES) $(tEventQueue_SOURCES) \
+	$(tGCFPort_SOURCES) $(tGCFTask1_SOURCES) $(tGCFTask2_SOURCES) \
+	$(tGCFTask3_SOURCES) $(tGCFTask4_SOURCES) $(tGCFTask5_SOURCES) \
+	$(tStateResult_SOURCES) $(tTimer_SOURCES) $(tmEcho_SOURCES) \
+	$(tmPing_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AR_FLAGS = @AR_FLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOCPP = @DOCPP@
+DOCPPFLAGS = @DOCPPFLAGS@
+DOXYGEN = @DOXYGEN@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+HAVE_COMMON_FALSE = @HAVE_COMMON_FALSE@
+HAVE_COMMON_TRUE = @HAVE_COMMON_TRUE@
+HAVE_DOCPP_FALSE = @HAVE_DOCPP_FALSE@
+HAVE_DOCPP_TRUE = @HAVE_DOCPP_TRUE@
+HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@
+HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@
+HAVE_LOG4CPLUS_FALSE = @HAVE_LOG4CPLUS_FALSE@
+HAVE_LOG4CPLUS_TRUE = @HAVE_LOG4CPLUS_TRUE@
+HAVE_LOG4CXX_FALSE = @HAVE_LOG4CXX_FALSE@
+HAVE_LOG4CXX_TRUE = @HAVE_LOG4CXX_TRUE@
+HAVE_MACIO_FALSE = @HAVE_MACIO_FALSE@
+HAVE_MACIO_TRUE = @HAVE_MACIO_TRUE@
+HAVE_SHMEM_FALSE = @HAVE_SHMEM_FALSE@
+HAVE_SHMEM_TRUE = @HAVE_SHMEM_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LOFARROOT = @LOFARROOT@
+LOFAR_DEPEND = @LOFAR_DEPEND@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MAKE_RPMS = @MAKE_RPMS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+RPMBUILD_PROG = @RPMBUILD_PROG@
+RPM_ARGS = @RPM_ARGS@
+RPM_CONFIGURE_ARGS = @RPM_CONFIGURE_ARGS@
+RPM_DIR = @RPM_DIR@
+RPM_PROG = @RPM_PROG@
+RPM_RELEASE = @RPM_RELEASE@
+RPM_TARBALL = @RPM_TARBALL@
+RPM_TARGET = @RPM_TARGET@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_BACKTRACE_FALSE = @USE_BACKTRACE_FALSE@
+USE_BACKTRACE_TRUE = @USE_BACKTRACE_TRUE@
+VERSION = @VERSION@
+YACC = @YACC@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+docpp_found = @docpp_found@
+doxygen_dot_found = @doxygen_dot_found@
+doxygen_found = @doxygen_found@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+lofar_compiler = @lofar_compiler@
+lofar_doctool = @lofar_doctool@
+lofar_root = @lofar_root@
+lofar_root_libdir = @lofar_root_libdir@
+lofar_sharedir = @lofar_sharedir@
+lofar_top_srcdir = @lofar_top_srcdir@
+lofar_use_root = @lofar_use_root@
+lofar_variant = @lofar_variant@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AUTOGEN = autogen
+SUFFIXES = .ph
+tmEcho_SOURCES = $(BUILT_SOURCES) Echo.cc Echo_Protocol.cc
+tmEcho_LDADD = ../src/libgcftm.la
+tmEcho_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND)
+tmPing_SOURCES = $(BUILT_SOURCES) Ping.cc Echo_Protocol.cc
+tmPing_LDADD = ../src/libgcftm.la
+tmPing_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND)
+tGCFPort_SOURCES = $(BUILT_SOURCES) Echo_Protocol.cc \
+						  tGCFPort.cc tGCFPort.h 
+
+tGCFPort_LDADD = ../src/libgcftm.la
+tGCFPort_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND)
+tTimer_SOURCES = $(BUILT_SOURCES) tTimer.cc
+tTimer_LDADD = ../src/libgcftm.la
+tTimer_DEPENDENCIES = ../src/libgcftm.la tTimer.h $(LOFAR_DEPEND)
+tEventQueue_SOURCES = $(BUILT_SOURCES) tEventQueue.cc tClient.cc Echo_Protocol.cc
+tEventQueue_LDADD = ../src/libgcftm.la
+tEventQueue_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND)
+tAutoOpen_SOURCES = $(BUILT_SOURCES) tAutoOpen.cc tServer.cc Echo_Protocol.cc
+tAutoOpen_LDADD = ../src/libgcftm.la
+tAutoOpen_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND)
+tStateResult_SOURCES = $(BUILT_SOURCES) tStateResult.cc tServer.cc Echo_Protocol.cc
+tStateResult_LDADD = ../src/libgcftm.la
+tStateResult_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND)
+tGCFTask1_SOURCES = $(BUILT_SOURCES) tGCFTask1.cc testTask.cc
+tGCFTask1_LDADD = ../src/libgcftm.la
+tGCFTask1_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND)
+tGCFTask2_SOURCES = $(BUILT_SOURCES) tGCFTask2.cc testTask.cc
+tGCFTask2_LDADD = ../src/libgcftm.la
+tGCFTask2_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND)
+tGCFTask3_SOURCES = $(BUILT_SOURCES) tGCFTask3.cc testTask.cc
+tGCFTask3_LDADD = ../src/libgcftm.la
+tGCFTask3_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND)
+tGCFTask4_SOURCES = $(BUILT_SOURCES) tGCFTask4.cc testTask.cc
+tGCFTask4_LDADD = ../src/libgcftm.la
+tGCFTask4_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND)
+tGCFTask5_SOURCES = $(BUILT_SOURCES) tGCFTask5.cc testTask.cc
+tGCFTask5_LDADD = ../src/libgcftm.la
+tGCFTask5_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND)
+BUILT_SOURCES = Echo_Protocol.ph 
+EXTRA_DIST = \
+	tmEcho.conf \
+	tmPing.conf \
+	tGCFPort.conf
+
+#CLEANFILES += tca.* .inslog* *.cc *.h $(top_builddir)/pure_cache docxxhtml/* *.log docxx_hdrs.names
+
+# DISTCLEANFILES also removes the md5 check files created by rub,
+# so configure is executed again.
+DISTCLEANFILES = \
+      pkgext*\
+      lofar_config.*\
+      FillPackage__Version* \
+      .doxygenrc \
+      *.spec \
+      *.md5-check \
+      *.err
+
+
+# Rules for building documentation using doxygen or doc++.
+# Default output directory is docxxhtml.
+DOCDIR := docxxhtml
+
+#
+#
+# Target to be able to do a system build.
+# By default it does a check, but no install.
+WITH_CLEAN = 0
+WITH_INSTALL = 0
+WITH_CHECK = 1
+CHECKTOOL = 
+
+# Define the default variables to export to the test scripts.
+TESTS_ENVIRONMENT = LOFARROOT="$(LOFARROOT)" \
+                    lofar_sharedir="$(lofar_sharedir)" \
+                    prefix="$(prefix)" \
+                    top_srcdir="$(top_srcdir)" \
+                    srcdir="$(srcdir)" \
+		    CHECKTOOLPROGS="$(CHECKTOOLPROGS)" \
+		    MPIBIN="$(MPIBIN)" \
+		    AIPSPP="$(AIPSPP)"
+
+all: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .ph .cc .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/Makefile.common $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  test/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkPROGRAMS:
+	@list='$(check_PROGRAMS)'; for p in $$list; do \
+	  f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  echo " rm -f $$p $$f"; \
+	  rm -f $$p $$f ; \
+	done
+tAutoOpen$(EXEEXT): $(tAutoOpen_OBJECTS) $(tAutoOpen_DEPENDENCIES) 
+	@rm -f tAutoOpen$(EXEEXT)
+	$(CXXLINK) $(tAutoOpen_LDFLAGS) $(tAutoOpen_OBJECTS) $(tAutoOpen_LDADD) $(LIBS)
+tEventQueue$(EXEEXT): $(tEventQueue_OBJECTS) $(tEventQueue_DEPENDENCIES) 
+	@rm -f tEventQueue$(EXEEXT)
+	$(CXXLINK) $(tEventQueue_LDFLAGS) $(tEventQueue_OBJECTS) $(tEventQueue_LDADD) $(LIBS)
+tGCFPort$(EXEEXT): $(tGCFPort_OBJECTS) $(tGCFPort_DEPENDENCIES) 
+	@rm -f tGCFPort$(EXEEXT)
+	$(CXXLINK) $(tGCFPort_LDFLAGS) $(tGCFPort_OBJECTS) $(tGCFPort_LDADD) $(LIBS)
+tGCFTask1$(EXEEXT): $(tGCFTask1_OBJECTS) $(tGCFTask1_DEPENDENCIES) 
+	@rm -f tGCFTask1$(EXEEXT)
+	$(CXXLINK) $(tGCFTask1_LDFLAGS) $(tGCFTask1_OBJECTS) $(tGCFTask1_LDADD) $(LIBS)
+tGCFTask2$(EXEEXT): $(tGCFTask2_OBJECTS) $(tGCFTask2_DEPENDENCIES) 
+	@rm -f tGCFTask2$(EXEEXT)
+	$(CXXLINK) $(tGCFTask2_LDFLAGS) $(tGCFTask2_OBJECTS) $(tGCFTask2_LDADD) $(LIBS)
+tGCFTask3$(EXEEXT): $(tGCFTask3_OBJECTS) $(tGCFTask3_DEPENDENCIES) 
+	@rm -f tGCFTask3$(EXEEXT)
+	$(CXXLINK) $(tGCFTask3_LDFLAGS) $(tGCFTask3_OBJECTS) $(tGCFTask3_LDADD) $(LIBS)
+tGCFTask4$(EXEEXT): $(tGCFTask4_OBJECTS) $(tGCFTask4_DEPENDENCIES) 
+	@rm -f tGCFTask4$(EXEEXT)
+	$(CXXLINK) $(tGCFTask4_LDFLAGS) $(tGCFTask4_OBJECTS) $(tGCFTask4_LDADD) $(LIBS)
+tGCFTask5$(EXEEXT): $(tGCFTask5_OBJECTS) $(tGCFTask5_DEPENDENCIES) 
+	@rm -f tGCFTask5$(EXEEXT)
+	$(CXXLINK) $(tGCFTask5_LDFLAGS) $(tGCFTask5_OBJECTS) $(tGCFTask5_LDADD) $(LIBS)
+tStateResult$(EXEEXT): $(tStateResult_OBJECTS) $(tStateResult_DEPENDENCIES) 
+	@rm -f tStateResult$(EXEEXT)
+	$(CXXLINK) $(tStateResult_LDFLAGS) $(tStateResult_OBJECTS) $(tStateResult_LDADD) $(LIBS)
+tTimer$(EXEEXT): $(tTimer_OBJECTS) $(tTimer_DEPENDENCIES) 
+	@rm -f tTimer$(EXEEXT)
+	$(CXXLINK) $(tTimer_LDFLAGS) $(tTimer_OBJECTS) $(tTimer_LDADD) $(LIBS)
+tmEcho$(EXEEXT): $(tmEcho_OBJECTS) $(tmEcho_DEPENDENCIES) 
+	@rm -f tmEcho$(EXEEXT)
+	$(CXXLINK) $(tmEcho_LDFLAGS) $(tmEcho_OBJECTS) $(tmEcho_LDADD) $(LIBS)
+tmPing$(EXEEXT): $(tmPing_OBJECTS) $(tmPing_DEPENDENCIES) 
+	@rm -f tmPing$(EXEEXT)
+	$(CXXLINK) $(tmPing_LDFLAGS) $(tmPing_OBJECTS) $(tmPing_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Echo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Echo_Protocol.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Ping.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tAutoOpen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tClient.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tEventQueue.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tGCFPort.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tGCFTask1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tGCFTask2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tGCFTask3.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tGCFTask4.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tGCFTask5.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tServer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tStateResult.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tTimer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testTask.Po@am__quote@
+
+.cc.o:
+@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+@am__fastdepCXX_TRUE@	if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+@am__fastdepCXX_TRUE@	if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+distclean-libtool:
+	-rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(mkdir_p) $(distdir)/..
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkdir_p) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+check: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile
+installdirs:
+install: $(BUILT_SOURCES)
+	$(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+	-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean \
+	clean-checkPROGRAMS clean-generic clean-libtool clean-local \
+	ctags distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-info-am
+
+%.ph: %.prot
+	$(AUTOGEN) --writable -L $(datadir)/MACIO $<
+
+%.cc: %.prot
+	$(AUTOGEN) --writable -L $(datadir)/MACIO $<
+
+%.conf:	tm-test.conf.in
+	ln -sf $< $@
+
+clean-local:
+	rm -f *.ph
+
+# CLEANFILES cannot delete directories, therefore use target clean-generic.
+clean-generic:
+	-rm -rf ti_files
+	-rm -f tca.*
+	-rm -f .inslog*
+	-rm -f *.log
+	-rm -f *.i
+	-rm -f *.s
+	-rm -f src/*.h
+	-rm -f *.hh
+	-rm -f *.cc
+	-rm -f *.cs_cc
+	-rm -f doxygen.cfg
+	-rm -rf $(top_builddir)/pure_cache
+	-rm -rf docxxhtml
+
+# Rule to delete all files generated by bootstrap.
+# This is sometimes needed when switching to another version of autotools.
+confclean: pkgclean
+pkgclean: distclean
+	  -rm -rf $(srcdir)/autom4te.cache
+	  -rm -f $(srcdir)/config.*
+	  -rm -f $(srcdir)/{configure,aclocal.m4,depcomp,install-sh,ltmain.sh}
+	  -rm -f $(srcdir)/{Makefile.in,missing,mkinstalldirs}
+	  -rm -f $(srcdir)/{Makefile.common,autoconf_share,lofarconf}
+
+# Make the rpm if possible.
+# Note:
+# MAKE_RPMS is set by lofar_init and possibly overwritten by lofar_general.
+# Older package releases include Makefile.common from $lofar_sharedir
+# with the effect that the include is handled by make.
+# Newer releases (as of 1-11-2005) include Makefile.common from $top_srcdir
+# with the effect that the include is handled by automake.
+# To be compatible with older releases, it was decided that the MAKE_RPMS
+# should be handled by make, hence the blank before endif. Otherwise
+# automake complains about an endif without an if.
+ ifeq "$(MAKE_RPMS)" "true"
+   rpm: dist @RPM_TARGET@
+   $(RPM_TARGET): $(DISTFILES)
+	${MAKE} dist
+	-mkdir -p $(RPM_DIR)/SRPMS
+	-mkdir -p `dirname $(RPM_TARGET)`
+	$(RPM_PROG) $(RPM_ARGS) $(RPM_TARBALL)
+	@echo Congratulations, $(RPM_TARGET) "(and friends)" should now exist.
+ endif
+# Put the phony target outside the if, otherwise automake gives
+# warnings if a .PHONY is also defined in the Makefile.am.
+.PHONY: rpm
+
+# Only preprocess the file.
+%.i: %.cc
+	$(CXX) -E $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $< > $@
+%.i: %.c
+	$(CC) -E $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $< > $@
+
+# Only compile (but not assemble) the file.
+%.s: %.cc
+	$(CXX) -S $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $<
+%.s: %.c
+	$(CC) -S $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $<
+
+# Rules for preprocessing idl files.
+# There should be a corresponding .cc file in the source directory
+# including the .cs_cc file.
+%.cs_cc: %.idl
+	$(IDLCXX) $(IDLFLAGS) $(AM_IDLFLAGS) $<
+	echo '#include "$*_c.cc"' >  $*.cs_cc
+	echo '#include "$*_s.cc"' >> $*.cs_cc
+
+# Rules for preprocessing Qt sources.
+%.moc.cc: %.h
+	$(QT_DIR)/bin/moc $< -o $@
+
+# Rule to build all test programs.
+test: $(check_PROGRAMS)
+
+# Rule to build and run one or more test programs.
+# The programs to build/run must be defined in the PGM variable.
+checkrun:
+	@if [ "$(PGM)" = "" ] ; then \
+	   echo "Error: use as: make (mem)checkrun PGM=testprogram"; \
+	 else \
+	   curwd=`pwd`; \
+	   bcurwd=`basename $$curwd`; \
+	   if [ "$$bcurwd" != test ]; then \
+	     echo "Error: run (mem)checkrun in test directory"; \
+	   else \
+	     PGMB=; \
+	     PGMT=; \
+	     for PGMVAR in $(PGM) ; \
+	     do \
+	       grep "^ *$${PGMVAR}_SOURCES" $(srcdir)/Makefile.am >& /dev/null; \
+	       if [ $$? = 0 ]; then \
+	         PGMB="$$PGMB $$PGMVAR"; \
+	       fi; \
+	       PGMTST=$$PGMVAR; \
+	       if [ -f $(srcdir)/$${PGMVAR}.sh ] ; then \
+	         PGMTST=$(srcdir)/$${PGMVAR}.sh; \
+	       elif [ -f $(srcdir)/$${PGMVAR}_test.sh ] ; then \
+	         PGMTST=$(srcdir)/$${PGMVAR}_test.sh; \
+	       fi; \
+	       PGMT="$$PGMT $$PGMTST"; \
+	     done; \
+	     echo "make check CHECKTOOL='$(CHECKTOOL)' check_PROGRAMS='$$PGMB' TESTS='$$PGMT'"; \
+	     make check CHECKTOOL="$(CHECKTOOL)" check_PROGRAMS="$$PGMB" TESTS="$$PGMT"; \
+	   fi \
+	 fi
+
+# Rule to run test programs using valgrind's memcheck tool.
+memcheck:
+	@$(RM) `find . -name "*.valgrind.*"`
+	make check CHECKTOOL='valgrind --tool=memcheck --num-callers=50 --leak-check=yes --track-fds=yes --log-file=[PROGNAME].valgrind'
+	@vgfils=`find . -name "*.valgrind.*"`; \
+	vgfils=`echo $$vgfils`; \
+	nrvg=`echo "$$vgfils" | wc -w`; \
+	nrvg=`echo $$nrvg`; \
+	if [ "$$nrvg" != 0  -a  "$$nrvg" != "" ]; then \
+	  echo ''; \
+	  echo "memcheck error summary from $$nrvg *.valgrind.* file(s)"; \
+	  echo '--------------------------------------------------'; \
+	  (grep "ERROR SUMMARY: " `echo $$vgfils` | grep -v " 0 errors ") || echo "No memory check errors"; \
+	  (grep "definitely lost: " `echo $$vgfils` | grep -v " 0 bytes ") || echo "No definite memory leaks"; \
+	  (grep "possibly lost: " `echo $$vgfils` | grep -v " 0 bytes ") || echo "No possible memory leaks"; \
+	  (grep " open file descriptor " `echo $$vgfils` | grep -v "descriptor [012]:") || echo "No file descriptor leaks"; \
+	fi
+
+# Rule to build and run memcheck for one or more test programs.
+# The programs to build/run must be defined in the PGM variable.
+memcheckrun:
+	$(RM) `find . -name "*.valgrind.*"`
+	make checkrun CHECKTOOL='valgrind --tool=memcheck --num-callers=50 --leak-check=yes --track-fds=yes --log-file=[PROGNAME].valgrind' PGM="$(PGM)"
+	@vgfils=`find . -name "*.valgrind.*"`; \
+	vgfils=`echo $$vgfils`; \
+	nrvg=`echo "$$vgfils" | wc -w`; \
+	nrvg=`echo $$nrvg`; \
+	if [ "$$nrvg" != 0  -a  "$$nrvg" != "" ]; then \
+	  echo ''; \
+	  echo "memcheckrun error summary from $$nrvg *.valgrind.* file(s)"; \
+	  echo '-----------------------------------------------------'; \
+	  (grep "ERROR SUMMARY: " `echo $$vgfils` | grep -v " 0 errors ") || echo "No memory check errors"; \
+	  (grep "definitely lost: " `echo $$vgfils` | grep -v " 0 bytes ") || echo "No definite memory leaks"; \
+	  (grep "possibly lost: " `echo $$vgfils` | grep -v " 0 bytes ") || echo "No possible memory leaks"; \
+	  (grep " open file descriptor " `echo $$vgfils` | grep -v "descriptor [012]:") || echo "No file descriptor leaks"; \
+	fi
+
+doc:
+	@if [ "$(lofar_doctool)" = "doxygen" ] ; then \
+	  cp $(top_builddir)/.doxygenrc doxygen.cfg ; \
+	  projnm=`(cd $(srcdir) && pwd) | sed -e "s%.*/LOFAR/%%"` ; \
+	  echo "PROJECT_NAME = $$projnm" >> doxygen.cfg ; \
+	  echo "INPUT = $(srcdir)" >> doxygen.cfg ; \
+	  echo "RECURSIVE = YES" >> doxygen.cfg ; \
+	  echo "HTML_OUTPUT = $(DOCDIR)" >> doxygen.cfg ; \
+	  echo "EXCLUDE = $(srcdir)/build $(srcdir)/test $(srcdir)/demo" >> doxygen.cfg; \
+          echo "GENERATE_TAGFILE = `basename $$projnm`.tag" >> doxygen.cfg ; \
+	  $(DOXYGEN) doxygen.cfg ; \
+	else \
+	  if [ "$(lofar_doctool)" = "docpp" ] ; then \
+	    $(DOCPP) $(DOCPPFLAGS) --dir $(DOCDIR) `find $(srcdir) -name "*.h" -print` ; \
+	  else \
+	    echo "Error: No documentation tool configured" ; \
+	  fi \
+	fi
+
+docthis:
+	@if [ "$(lofar_doctool)" = "doxygen" ] ; then \
+	  cp $(top_builddir)/.doxygenrc doxygen.cfg ; \
+	  projnm=`(cd $(srcdir) && pwd) | sed -e "s%.*/LOFAR/%%"` ; \
+	  echo "PROJECT_NAME = $$projnm" >> doxygen.cfg ; \
+	  echo "INPUT = $(srcdir)/src" >> doxygen.cfg ; \
+	  echo "RECURSIVE = NO" >> doxygen.cfg ; \
+	  echo "HTML_OUTPUT = $(DOCDIR)" >> doxygen.cfg ; \
+	  $(DOXYGEN) doxygen.cfg ; \
+	else \
+	  if [ "$(lofar_doctool)" = "docpp" ] ; then \
+	    $(DOCPP) $(DOCPPFLAGS) --dir $(DOCDIR) $(srcdir)/*.h ; \
+	  else \
+	    echo "Error: No documentation tool configured" ; \
+	  fi \
+	fi
+build_system:
+	@if test 2 -eq $(WITH_CLEAN); then \
+	  $(MAKE) distclean ; \
+	  ../../lofarconf; \
+	fi; \
+	if test 1 -eq $(WITH_CLEAN); then \
+	  $(MAKE) clean ; \
+	fi; \
+	$(MAKE); \
+	if test 1 -eq $(WITH_CHECK); then \
+	  $(MAKE) check CHECKTOOL="$(CHECKTOOL)"; \
+	fi; \
+	if test 1 -eq $(WITH_INSTALL); then \
+	  $(MAKE) install ; \
+	fi;
+
+# Show the important make variables.
+show:
+	@echo "CXX      = $(CXX)";
+	@echo "   `$(CXX) --version | head -1`";
+	@echo "CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS)";
+	@echo "CXXFLAGS = $(AM_CXXFLAGS) $(CXXFLAGS)";
+	@echo "LDFLAGS  = $(AM_LDFLAGS) $(LDFLAGS)";
+	@echo "LIBS     = $(LIBS)";
+	@echo "MPIBIN   = $(MPIBIN)";
+	@echo "AIPSPP   = $(AIPSPP)";
+	@echo "prefix   = $(prefix)";
+
+help:
+	@echo "make targets";
+	@echo "------------";
+	@echo "show              show important make variables";
+	@echo "pgm               build test program pgm (in test directory)";
+	@echo "test              build all test programs";
+	@echo "check             build, run, and check all test programs";
+	@echo "check CHECKTOOL=  check test programs with a checktool (like valgrind)";
+	@echo "memcheck          check CHECKTOOL='valgrind --tool=memcheck"
+	@echo "                    --num-callers=50 --leak-check=yes --track-fds=yes'"
+	@echo "checkrun PGM=     build, run, and check given test program(s)";
+	@echo "memcheckrun PGM=  build, run, and memcheck given test program(s)";
+	@echo ""
+	@echo "file.o            make object file (in src or test directory)";
+	@echo "file.i            make preprocessed file";
+	@echo "file.s            make assembly file";
+	@echo "clean             remove object files, etc."
+	@echo "distclean         remove almost everything; requires a new lofarconf";
+	@echo "pkgclean          distclean and remove files generated by bootstrap";
+	@echo "                    requires a new bootstrap and lofarconf";
+	@echo "install           install package in $(prefix)";
+	@echo "dist              make a distribution";
+	@echo "distcheck         make and check a distribution";
+	@echo "rpm               make an rpm";
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/MAC/GCF/TM/test/Ping.cc b/MAC/GCF/TM/test/Ping.cc
index f7bff32d5529c15ec5f4bba18e9e7af6ad1de005..eddbcc96365201aa754337d576bc33621d30a796 100644
--- a/MAC/GCF/TM/test/Ping.cc
+++ b/MAC/GCF/TM/test/Ping.cc
@@ -23,10 +23,10 @@
 //
 
 #include <lofar_config.h>
-
+#include <Common/LofarLogger.h>
 #include "Ping.h"
 #include "Echo_Protocol.ph"
-#include <Common/lofar_iostream.h>
+
 
 namespace LOFAR 
 {
@@ -58,7 +58,7 @@ Ping::Ping(string name)
    * - This is a Service Access Port which uses the
    *   ECHO_PROTOCOL 
    */
-  client.init(*this, "client", GCFPortInterface::SAP, ECHO_PROTOCOL);
+  client.init(*this, "EchoServer:test", GCFPortInterface::SAP, ECHO_PROTOCOL);
 }
 
 Ping::~Ping()
@@ -68,6 +68,8 @@ Ping::~Ping()
 
 GCFEvent::TResult Ping::initial(GCFEvent& e, GCFPortInterface& /*port*/)
 {
+	LOG_DEBUG_STR("Ping::initial: " << eventName(e));
+
   GCFEvent::TResult status = GCFEvent::HANDLED;
 
   switch (e.signal)
@@ -107,6 +109,8 @@ GCFEvent::TResult Ping::initial(GCFEvent& e, GCFPortInterface& /*port*/)
 
 GCFEvent::TResult Ping::connected(GCFEvent& e, GCFPortInterface& p)
 {
+	LOG_DEBUG_STR("Ping::connected: " << eventName(e));
+
   GCFEvent::TResult status = GCFEvent::HANDLED;
 
   static int seqnr = 0;
@@ -156,6 +160,8 @@ GCFEvent::TResult Ping::connected(GCFEvent& e, GCFPortInterface& p)
 
 GCFEvent::TResult Ping::awaiting_echo(GCFEvent& e, GCFPortInterface& p)
 {
+	LOG_DEBUG_STR("Ping::awaiting_echo: " << eventName(e));
+
   GCFEvent::TResult status = GCFEvent::HANDLED;
 
   switch (e.signal)
@@ -175,7 +181,7 @@ GCFEvent::TResult Ping::awaiting_echo(GCFEvent& e, GCFPortInterface& p)
     	     << time_elapsed(&(echo.ping_time), &echo_time) << " sec."<< endl;
       if (echo.seqnr == 600)
       {
-        GCFTask::stop();
+        GCFScheduler::instance()->stop();
       }
       else
       {
@@ -206,13 +212,13 @@ using namespace LOFAR::GCF::TM;
 
 int main(int argc, char* argv[])
 {
-  GCFTask::init(argc, argv);
+  GCFScheduler::instance()->init(argc, argv);
 
   Ping ping_task("PING");
 
   ping_task.start(); // make initial transition
 
-  GCFTask::run();
+  GCFScheduler::instance()->run();
 
   return 0;
 }
diff --git a/MAC/GCF/TM/test/Ping.h b/MAC/GCF/TM/test/Ping.h
index 2eb044d97a4924eae78a7ff12de2e9940dd5b402..b32f0e43d1487041ae4546ea0e045ea7bbe02fc5 100644
--- a/MAC/GCF/TM/test/Ping.h
+++ b/MAC/GCF/TM/test/Ping.h
@@ -27,12 +27,9 @@
 #include <GCF/TM/GCF_Control.h>
 #include <sys/time.h>
 
-namespace LOFAR 
-{
- namespace GCF 
- {
-  namespace TM 
-  {
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
 
 /**
  * The Ping task sends ECHO_PING events to the Echo task and expects 
diff --git a/MAC/GCF/TM/test/tAutoOpen.cc b/MAC/GCF/TM/test/tAutoOpen.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7a9ff80f2f220e43cb0f39662235be5d6979fddc
--- /dev/null
+++ b/MAC/GCF/TM/test/tAutoOpen.cc
@@ -0,0 +1,370 @@
+//
+//  tAutoOpen.cc: Test program to test all kind of usage of the GCF ports.
+//
+//  Copyright (C) 2009
+//  ASTRON (Netherlands Foundation for Research in Astronomy)
+//  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//
+//  $Id$
+
+#include <lofar_config.h>
+#include <Common/LofarLogger.h>
+#include <GCF/TM/GCF_Scheduler.h>
+#include "Echo_Protocol.ph"
+#include "tAutoOpen.h"
+#include "tServer.h"
+
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
+
+
+// Constructors of both classes
+tAutoOpen::tAutoOpen(string name) : 
+	GCFTask        ((State)&tAutoOpen::retryTest, name),
+	itsTimerPort   (0),
+	itsConn 	   (0)
+{ 
+	registerProtocol (ECHO_PROTOCOL, ECHO_PROTOCOL_STRINGS);
+}
+
+tAutoOpen::~tAutoOpen()
+{
+	delete itsTimerPort;
+}
+
+//
+// retryTest
+//
+// Try to autoOpen a connection to a non existing server specifying several retries but no timeout.
+//
+GCFEvent::TResult tAutoOpen::retryTest(GCFEvent& event, GCFPortInterface& /*port*/)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tAutoOpen::retryTest: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		break;
+
+	case F_INIT:
+		itsConn = new GCFTCPPort(*this, "Echo:Server", GCFPortInterface::SAP, ECHO_PROTOCOL, false);
+		ASSERTSTR(itsConn, "Can't allocate a TCPport");
+		LOG_DEBUG("Calling autoOpen(5, 0, 4)");
+		itsConn->autoOpen(5, 0, 4); // nrRetry, timeout, retryItv
+		break;
+
+	case F_CONNECTED:
+		LOG_DEBUG_STR("THIS IS REALY STRANGE!!!");
+		GCFScheduler::instance()->stop();
+		break;
+
+	case F_DISCONNECTED:
+		LOG_DEBUG_STR("Seems that retries are working, going to try the timeout.");
+		TRAN(tAutoOpen::timeoutTest);
+		break;
+
+	case F_EXIT:
+		LOG_INFO("F_EXIT event in retryTest");
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in retryTest: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+//
+// timeoutTest
+//
+// Try to autoOpen a connection to a non existing server specifying a timeout
+//
+GCFEvent::TResult tAutoOpen::timeoutTest(GCFEvent& event, GCFPortInterface& /*port*/)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tAutoOpen::timeoutTest: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		LOG_DEBUG("\n\n\n\nCalling autoOpen(0, 18, 4)");
+		itsConn->autoOpen(0, 18, 4); // nrRetry, timeout, retryItv
+		break;
+
+	case F_CONNECTED:
+		LOG_DEBUG_STR("THIS IS REALY STRANGE!!!");
+		GCFScheduler::instance()->stop();
+		break;
+
+	case F_DISCONNECTED:
+		LOG_DEBUG_STR("timeTest seems to be working, trying next mode");
+		TRAN(tAutoOpen::zeroTest);
+		break;
+
+	case F_EXIT:
+		LOG_INFO("F_EXIT event in timeoutTest");
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in timeoutTest: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+
+//
+// zeroTest
+//
+// Try to autoOpen a connection to a non existing server not setting the number of retries
+// nor setting the timeout timer. This should behave like a normal open() call.
+//
+GCFEvent::TResult tAutoOpen::zeroTest(GCFEvent& event, GCFPortInterface& /*port*/)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tAutoOpen::zeroTest: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		LOG_DEBUG("\n\n\n\nCalling autoOpen(0, 0, 4)");
+		itsConn->autoOpen(0, 0, 4); // nrRetry, timeout, retryItv
+		break;
+
+	case F_CONNECTED:
+		LOG_DEBUG_STR("THIS IS REALY STRANGE!!!");
+		GCFScheduler::instance()->stop();
+		break;
+
+	case F_DISCONNECTED:
+		LOG_DEBUG_STR("Seems to be working, going to the next test");
+		TRAN(tAutoOpen::double1Test);
+		break;
+
+	case F_EXIT:
+		LOG_INFO("F_EXIT event in zeroTest");
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in zeroTest: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+//
+// double1Test
+//
+// Try to autoOpen a connection to a non existing server setting the number of retries
+// AND setting the timeout timer. The nr of retries is smaller than the maxTimeout.
+//
+GCFEvent::TResult tAutoOpen::double1Test(GCFEvent& event, GCFPortInterface& /*port*/)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tAutoOpen::double1Test: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		LOG_DEBUG("\n\n\n\nCalling autoOpen(3, 60, 4)");
+		itsConn->autoOpen(3, 60, 4); // nrRetry, timeout, retryItv
+		break;
+
+	case F_CONNECTED:
+		LOG_DEBUG_STR("THIS IS REALY STRANGE!!!");
+		GCFScheduler::instance()->stop();
+		break;
+
+	case F_DISCONNECTED:
+		LOG_DEBUG_STR("Seems to be working, going to the next test");
+		TRAN(tAutoOpen::double2Test);
+		break;
+
+	case F_EXIT:
+		LOG_INFO("F_EXIT event in double1Test");
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in double1Test: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+//
+// double2Test
+//
+// Try to autoOpen a connection to a non existing server setting the number of retries
+// AND setting the timeout timer. The nr of retries is larger than the maxTimeout.
+//
+GCFEvent::TResult tAutoOpen::double2Test(GCFEvent& event, GCFPortInterface& /*port*/)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tAutoOpen::double2Test: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		LOG_DEBUG("\n\n\n\nCalling autoOpen(6, 10, 4)");
+		itsConn->autoOpen(6, 10, 4); // nrRetry, timeout, retryItv
+		break;
+
+	case F_CONNECTED:
+		LOG_DEBUG_STR("THIS IS REALY STRANGE!!!");
+		GCFScheduler::instance()->stop();
+		break;
+
+	case F_DISCONNECTED:
+		LOG_DEBUG_STR("Seems to be working, going to the next test");
+		TRAN(tAutoOpen::openTest);
+		break;
+
+	case F_EXIT:
+		LOG_INFO("F_EXIT event in double2Test");
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in double2Test: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+//
+// openTest
+//
+// Test is the old open() call is still working.
+//
+GCFEvent::TResult tAutoOpen::openTest(GCFEvent& event, GCFPortInterface& /*port*/)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tAutoOpen::openTest: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		LOG_DEBUG("\n\n\n\nCalling open()");
+		itsConn->open();
+		break;
+
+	case F_CONNECTED:
+		LOG_DEBUG_STR("THIS IS REALY STRANGE!!!");
+		GCFScheduler::instance()->stop();
+		break;
+
+	case F_DISCONNECTED:
+		LOG_DEBUG_STR("Seems to be working, going to last test");
+		TRAN(tAutoOpen::relayedOpenTest);
+		break;
+
+	case F_EXIT:
+		LOG_INFO("F_EXIT event in openTest");
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in openTest: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+//
+// relayedOpenTest
+//
+// Start a server task that will open the listener after 25 second. Start an autoOpen call
+// in this taks and wait till the connection is established.
+//
+GCFEvent::TResult tAutoOpen::relayedOpenTest(GCFEvent& event, GCFPortInterface& port)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tAutoOpen::relayedOpenTest: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		LOG_DEBUG("\n\n\n\nStarting the server task");
+		tServer*	server = new tServer("Server", 25);
+		server->start();
+		itsConn->autoOpen(10, 0, 10);	// connect within 100 seconds.
+		break;
+
+	case F_CONNECTED: {
+		LOG_DEBUG("COOL its is realy working");
+		EchoPingEvent	ping;
+		ping.seqnr=300563;
+		port.send(ping);
+		break;
+	}
+
+	case ECHO_ECHO: {
+		EchoEchoEvent	echo(event);
+		if (echo.seqnr != 300563) {
+			LOG_ERROR("Wrong sequence number");
+		}
+		else {
+			LOG_DEBUG("Got the right answer from the server, FINISHED the tests");
+		}
+		GCFScheduler::instance()->stop();
+		break;
+	}
+
+	case F_DISCONNECTED:
+		LOG_DEBUG_STR("WE STILL HAVE A PROBLEM");
+		break;
+
+	case F_EXIT:
+		LOG_INFO("F_EXIT event in relayedOpenTest");
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in relayedOpenTest: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
+
+using namespace LOFAR::GCF::TM;
+
+//
+// MAIN()
+//
+int main(int argc, char* argv[])
+{
+	GCFScheduler*	theScheduler(GCFScheduler::instance());
+	theScheduler->init(argc, argv);
+
+	tAutoOpen	clientTask("clientTask");
+	clientTask.start(); // make initial transition
+
+	theScheduler->run();
+
+	return (0);
+}
diff --git a/MAC/GCF/TM/test/tAutoOpen.h b/MAC/GCF/TM/test/tAutoOpen.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc6308d5230a264c81706eabae8f661428b1b1e8
--- /dev/null
+++ b/MAC/GCF/TM/test/tAutoOpen.h
@@ -0,0 +1,66 @@
+//
+//  tAutoOpen.h: Test program to test all kind of usage of the GCF ports.
+//
+//  Copyright (C) 2006
+//  ASTRON (Netherlands Foundation for Research in Astronomy)
+//  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//
+//  $Id$
+//
+
+#ifndef _TEVENTQUEUE_H
+#define _TEVENTQUEUE_H
+
+#include <GCF/TM/GCF_Control.h>
+
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
+
+//
+// The tests use two different tasks, a tServer task and a tClient task.
+// In each test a different way of resolving the addresses is used or
+// different device types are used.
+// The tServer and tClient class use the Echo protocol to test the
+// communication.
+//
+
+class tAutoOpen : public GCFTask
+{
+public:
+	tAutoOpen (string name);
+	~tAutoOpen();
+
+	// The test states
+	GCFEvent::TResult retryTest 	  (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult timeoutTest 	  (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult zeroTest	 	  (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult double1Test 	  (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult double2Test 	  (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult openTest	 	  (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult relayedOpenTest (GCFEvent& e, GCFPortInterface& p);
+
+private:
+	GCFTimerPort*	itsTimerPort;
+	GCFTCPPort*		itsListener;
+	GCFTCPPort*		itsConn;
+};
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
+#endif
diff --git a/MAC/GCF/TM/test/tClient.cc b/MAC/GCF/TM/test/tClient.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a8563f5b7c6194f04bc6dd1d6db0b3d610a09ec7
--- /dev/null
+++ b/MAC/GCF/TM/test/tClient.cc
@@ -0,0 +1,145 @@
+//
+//  tClient.cc: Test program to test all kind of usage of the GCF ports.
+//
+//  Copyright (C) 2006
+//  ASTRON (Netherlands Foundation for Research in Astronomy)
+//  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//
+//  $Id$
+
+#include <lofar_config.h>
+#include <Common/LofarLogger.h>
+#include <GCF/TM/GCF_Scheduler.h>
+#include "Echo_Protocol.ph"
+#include "tClient.h"
+
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
+
+
+// Constructors of both classes
+tClient::tClient(string name) : 
+	GCFTask         ((State)&tClient::connect2Server, name),
+	itsTimerPort    (0),
+	itsDataPort		(0)
+{ 
+}
+
+tClient::~tClient()
+{
+	delete itsTimerPort;
+	delete itsDataPort;
+}
+
+//
+// connect2Server
+//
+// We simply set one timer in different ways and wait for the timer to expire.
+//
+GCFEvent::TResult tClient::connect2Server(GCFEvent& event, GCFPortInterface& /*port*/)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tClient::connect2Server: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		itsTimerPort = new GCFTimerPort(*this, "timerPort");
+		ASSERTSTR(itsTimerPort, "Failed to open timerport");
+		break;
+
+	case F_INIT:
+		LOG_DEBUG_STR("trying to connect 2 the server");
+		itsDataPort = new GCFTCPPort(*this, "EchoServer:v1.0", GCFPortInterface::SAP, ECHO_PROTOCOL, false);
+		ASSERTSTR(itsDataPort, "Cannot allocate a data port");
+		itsDataPort->open();
+		break;
+
+	case F_CONNECTED: 
+		LOG_INFO("YES, we are connected, Sending a ping within 5 seconds");
+		itsTimerPort->setTimer(5.0);
+		break;
+
+	case F_TIMER:
+		TRAN(tClient::sendPing);
+		break;
+
+	case F_DISCONNECTED: 
+		LOG_INFO("SH..., the connection failed");
+		break;
+
+	case F_EXIT:
+		LOG_INFO("F_EXIT event in connect2Server");
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in connect2Server: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+//
+// sendPing
+//
+// Send a Ping command and wait for the response
+//
+GCFEvent::TResult tClient::sendPing(GCFEvent& event, GCFPortInterface& /*port*/)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tClient::sendPing: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY: {
+		EchoPingEvent	ping;
+		ping.seqnr = 25;
+		itsDataPort->send(ping);
+		break;
+	}
+
+	case ECHO_ECHO: {
+		EchoEchoEvent	echo(event);
+		LOG_INFO("YES, we got an echo, closing connection");
+		itsDataPort->close();
+		break;
+	}
+
+	case F_DISCONNECTED: 
+		LOG_INFO("Port is closed");
+		GCFScheduler::instance()->stop();
+		break;
+
+	case F_EXIT:
+		LOG_INFO("F_EXIT event in sendPing");
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in connect2Server: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
+
diff --git a/MAC/GCF/TM/test/tClient.h b/MAC/GCF/TM/test/tClient.h
new file mode 100644
index 0000000000000000000000000000000000000000..a0bde272b1e007cdfc44fca51223000731efb0f3
--- /dev/null
+++ b/MAC/GCF/TM/test/tClient.h
@@ -0,0 +1,60 @@
+//
+//  tClient.h: Test program to test all kind of usage of the GCF ports.
+//
+//  Copyright (C) 2006
+//  ASTRON (Netherlands Foundation for Research in Astronomy)
+//  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//
+//  $Id$
+//
+
+#ifndef _TCLIENT_H
+#define _TCLIENT_H
+
+#include <GCF/TM/GCF_Control.h>
+
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
+
+//
+// The tests use two different tasks, a tServer task and a tClient task.
+// In each test a different way of resolving the addresses is used or
+// different device types are used.
+// The tServer and tClient class use the Echo protocol to test the
+// communication.
+//
+
+class tClient : public GCFTask
+{
+public:
+	tClient (string name);
+	~tClient();
+
+	// The test states
+	GCFEvent::TResult connect2Server 	  (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult sendPing			  (GCFEvent& e, GCFPortInterface& p);
+
+private:
+	GCFTimerPort*	itsTimerPort;
+	GCFTCPPort*		itsDataPort;
+};
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
+#endif
diff --git a/MAC/GCF/TM/test/tEventQueue.cc b/MAC/GCF/TM/test/tEventQueue.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e30fe4acaf604f274c7bddd0b9b05959f12657ff
--- /dev/null
+++ b/MAC/GCF/TM/test/tEventQueue.cc
@@ -0,0 +1,339 @@
+//
+//  tEventQueue.cc: Test program to test all kind of usage of the GCF ports.
+//
+//  Copyright (C) 2006
+//  ASTRON (Netherlands Foundation for Research in Astronomy)
+//  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//
+//  $Id$
+
+#include <lofar_config.h>
+#include <Common/LofarLogger.h>
+#include <GCF/TM/GCF_Scheduler.h>
+#include "Echo_Protocol.ph"
+#include "tEventQueue.h"
+#include "tClient.h"
+
+static	int	gTest = 0;
+static	int	gTimerID;
+
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
+
+
+// Constructors of both classes
+tEventQueue::tEventQueue(string name) : 
+	GCFTask         ((State)&tEventQueue::timerTest, name),
+	itsTimerPort    (0)
+{ 
+	registerProtocol (ECHO_PROTOCOL, ECHO_PROTOCOL_STRINGS);
+}
+
+tEventQueue::~tEventQueue()
+{
+	delete itsTimerPort;
+}
+
+//
+// timerTest
+//
+// We simply set one timer in different ways and wait for the timer to expire.
+//
+GCFEvent::TResult tEventQueue::timerTest(GCFEvent& event, GCFPortInterface& /*port*/)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tEventQueue::timerTest: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		itsTimerPort = new GCFTimerPort(*this, "timerPort");
+		ASSERTSTR(itsTimerPort, "Failed to open timerport");
+		break;
+
+	case F_INIT:
+		gTest=1;
+		gTimerID = itsTimerPort->setTimer(1.0);
+		LOG_DEBUG_STR("setTimer(1.0) = " << gTimerID);
+		break;
+
+	case F_TIMER: {
+		switch (gTest) {
+			case 1: {	// wait for setTimer(1.0)
+				GCFTimerEvent& timerEvent = static_cast<GCFTimerEvent&>(event);
+				LOG_DEBUG_STR("ID = " << timerEvent.id << ", arg = " << timerEvent.arg);
+
+				gTimerID = itsTimerPort->setTimer(1.0, 2.0);
+				LOG_DEBUG_STR("setTimer(1.0, 2.0) = " << gTimerID);
+				gTest++;
+			}
+			break;
+
+			case 2: { // wait for first expire of setTimer(1.0, 2.0)
+				GCFTimerEvent& timerEvent = static_cast<GCFTimerEvent&>(event);
+				LOG_DEBUG_STR("ID = " << timerEvent.id << ", arg = " << timerEvent.arg);
+				gTest++;
+			}
+			break;
+
+			case 3: {	// wait for second expire of setTimer(1.0, 2.0)
+				GCFTimerEvent& timerEvent = static_cast<GCFTimerEvent&>(event);
+				LOG_DEBUG_STR("ID = " << timerEvent.id << ", arg = " << timerEvent.arg);
+				itsTimerPort->cancelTimer(gTimerID);
+
+				gTimerID = itsTimerPort->setTimer(1.0, 1.0, (char*)"pietje puk");
+				LOG_DEBUG_STR("setTimer(1.0, 0.0, 'pietje puk') = " << gTimerID);
+				gTest++;
+			}
+			break;
+			case 4: {
+				GCFTimerEvent& timerEvent = static_cast<GCFTimerEvent&>(event);
+				LOG_DEBUG_STR("ID = " << timerEvent.id << ", arg = " << timerEvent.arg);
+				LOG_DEBUG_STR("ID = " << timerEvent.id << ", *arg = " << (char*)timerEvent.arg);
+				gTest++;
+			}
+			break;
+
+			default: {
+				GCFTimerEvent& timerEvent = static_cast<GCFTimerEvent&>(event);
+				LOG_DEBUG_STR("ID = " << timerEvent.id << ", *arg = " << (char*)timerEvent.arg);
+				if (gTest++ > 8) {
+					itsTimerPort->cancelTimer(gTimerID);
+					LOG_INFO("Timertest passed, Going to the next statemachine\n\n\n");
+					TRAN(tEventQueue::tranTest);
+					LOG_INFO("Just after 'TRAN(tEventQueue::tranTest)', still in timerTest");
+				}
+			}
+			break;
+		}
+		break;
+	}
+	break;
+
+	case F_EXIT:
+		LOG_INFO("F_EXIT event in timerTest");
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in timerTest: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+//
+// tranTest
+//
+// We simply set one timer in different ways and wait for the timer to expire.
+//
+GCFEvent::TResult tEventQueue::tranTest(GCFEvent& event, GCFPortInterface& /*port*/)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tEventQueue::tranTest: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		LOG_INFO("Just setting a timer to 5 seconds");
+		itsTimerPort->setTimer(5.0);
+		break;
+
+	case F_TIMER:
+		LOG_DEBUG("Timer expired, going to listener test\n\n\n");
+		TRAN(tEventQueue::listenerTest);
+		break;
+
+	case F_EXIT:
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in tranTest: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+//
+// listenerTest 3
+//
+// Opening a listener port AND tries to start a task in a running scheduler.
+//
+GCFEvent::TResult tEventQueue::listenerTest(GCFEvent& event, GCFPortInterface& port)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tEventQueue::listenerTest: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY: {
+			LOG_INFO("Going to open a listener port");
+			itsListener = new GCFTCPPort(*this, "EchoServer:v1.0", GCFPortInterface::MSPP, ECHO_PROTOCOL);
+			ASSERTSTR(itsListener, "Failed to allocate listenerport");
+		}
+		// NO BREAK
+	case F_TIMER:
+		itsListener->open();		// results in F_DISCON or F_CONN
+		break;
+
+	case F_DISCONNECTED:
+		LOG_INFO("Opening listener failed, waiting for close event");
+		port.close();
+		break;
+
+	case F_CLOSED:
+		LOG_INFO("Listener closed, setting timer to 2 seconds for retry");
+		itsTimerPort->setTimer(2.0);
+		break;
+
+	case F_CONNECTED: {
+		itsTimerPort->cancelAllTimers();
+		LOG_INFO("Listener opened, creating a new task now that will connect to me\n\n\n");
+		tClient*	client = new tClient("client");
+		client->start();
+		TRAN(tEventQueue::wait4client2connect);
+		break;
+	}
+
+	case F_EXIT:
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in listenerTest: " << eventName(event));
+		status = GCFEvent::NEXT_STATE;
+		break;
+	}
+
+	return status;
+}
+//
+// wait4client2connect
+//
+// Opening a listener port
+//
+GCFEvent::TResult tEventQueue::wait4client2connect(GCFEvent& event, GCFPortInterface& port)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tEventQueue::wait4client2connect: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		itsTimerPort->setTimer(30.0);		// in case it does not work
+		break;
+
+	case F_TIMER:
+		LOG_INFO("Client did NOT connect, bailing out!");
+		GCFScheduler::instance()->stop();
+		break;
+
+	case F_ACCEPT_REQ:
+		itsClient = new GCFTCPPort();
+		itsClient->init(*this, "client", GCFPortInterface::SPP, ECHO_PROTOCOL);
+		ASSERTSTR(itsListener->accept(*itsClient), "ACCEPT FAILED");
+		break;
+
+	case F_CONNECTED:
+		LOG_INFO("Client is connected, going to do my Server state\n\n\n");
+		itsTimerPort->cancelAllTimers();
+		TRAN(tEventQueue::serverState);
+		break;
+
+	case F_EXIT:
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in wait4client2connect: " << eventName(event));
+		status = GCFEvent::NEXT_STATE;
+		break;
+	}
+
+	return status;
+}
+
+//
+// serverState
+//
+// wait for Ping messages and reply to them
+//
+GCFEvent::TResult tEventQueue::serverState(GCFEvent& event, GCFPortInterface& port)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tEventQueue::serverState: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		itsTimerPort->setTimer(30.0);		// in case it does not work
+		break;
+
+	case F_TIMER:
+		LOG_INFO("Client did NOT send a PING, bailing out!");
+		GCFScheduler::instance()->stop();
+		break;
+
+	case ECHO_PING: {
+		EchoPingEvent	ping(event);
+		EchoEchoEvent	echo;
+		echo.seqnr     = ping.seqnr;
+		port.send(echo);
+		itsTimerPort->cancelAllTimers();
+		LOG_DEBUG_STR("YES, ping was received, echo was sent, I'm ready!");
+		break;
+	}
+
+	case F_DISCONNECTED:
+		LOG_DEBUG_STR("Closing port because i received a disconnect event");
+		port.close();
+
+	case F_CLOSED:
+		LOG_DEBUG_STR("Succesfully terminated the test, Stopping program");
+		GCFScheduler::instance()->stop();
+		break;
+
+	case F_EXIT:
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in serverState: " << eventName(event));
+		status = GCFEvent::HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
+
+using namespace LOFAR::GCF::TM;
+
+//
+// MAIN()
+//
+int main(int argc, char* argv[])
+{
+	GCFScheduler*	theScheduler(GCFScheduler::instance());
+	theScheduler->init(argc, argv);
+
+	tEventQueue	eqTask("eqTask");
+	eqTask.start(); // make initial transition
+
+	theScheduler->run();
+
+	return (0);
+}
diff --git a/MAC/GCF/TM/test/tEventQueue.h b/MAC/GCF/TM/test/tEventQueue.h
new file mode 100644
index 0000000000000000000000000000000000000000..64614e9c1f9a5f7727758c8c4ffeae8c36a2a9f4
--- /dev/null
+++ b/MAC/GCF/TM/test/tEventQueue.h
@@ -0,0 +1,64 @@
+//
+//  tEventQueue.h: Test program to test all kind of usage of the GCF ports.
+//
+//  Copyright (C) 2006
+//  ASTRON (Netherlands Foundation for Research in Astronomy)
+//  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//
+//  $Id$
+//
+
+#ifndef _TEVENTQUEUE_H
+#define _TEVENTQUEUE_H
+
+#include <GCF/TM/GCF_Control.h>
+
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
+
+//
+// The tests use two different tasks, a tServer task and a tClient task.
+// In each test a different way of resolving the addresses is used or
+// different device types are used.
+// The tServer and tClient class use the Echo protocol to test the
+// communication.
+//
+
+class tEventQueue : public GCFTask
+{
+public:
+	tEventQueue (string name);
+	~tEventQueue();
+
+	// The test states
+	GCFEvent::TResult timerTest 		  (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult tranTest 			  (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult listenerTest 		  (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult wait4client2connect (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult serverState		  (GCFEvent& e, GCFPortInterface& p);
+
+private:
+	GCFTimerPort*	itsTimerPort;
+	GCFTCPPort*		itsListener;
+	GCFTCPPort*		itsClient;
+};
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
+#endif
diff --git a/MAC/GCF/TM/test/tGCFPort.cc b/MAC/GCF/TM/test/tGCFPort.cc
index f1692480b14b41aca000166e6a61e3428644d631..d18eda8290478703718b27a74741bd4782cc61aa 100644
--- a/MAC/GCF/TM/test/tGCFPort.cc
+++ b/MAC/GCF/TM/test/tGCFPort.cc
@@ -797,7 +797,7 @@ GCFEvent::TResult tServer::test5(GCFEvent& event, GCFPortInterface& /*port*/)
 	case F_DISCONNECTED:
 		if (itsFinished) {	// timer exists when msg was received.
 			finishTest(5);
-			GCFTask::stop();
+			GCFScheduler::instance()->stop();
 //			TRAN(tServer::test3);
 		}
 		else {
@@ -892,7 +892,7 @@ GCFEvent::TResult tClient::test5(GCFEvent& event, GCFPortInterface& port)
 		if (itsFinishedTimer) {
 			LOG_INFO ("Client:Lost connection with server");
 			finishTest(5);
-			GCFTask::stop();
+			GCFScheduler::instance()->stop();
 //			TRAN(tClient::test3);
 		}
 		else {
@@ -929,7 +929,7 @@ using namespace LOFAR::GCF::TM;
 //
 int main(int argc, char* argv[])
 {
-	GCFTask::init(argc, argv);
+	GCFScheduler::instance()->init(argc, argv);
 
 	tServer	serverTask("SERVER");
 	tClient	clientTask("CLIENT");
@@ -937,7 +937,7 @@ int main(int argc, char* argv[])
 	serverTask.start(); // make initial transition
 	clientTask.start(); // make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	LOG_INFO_STR("Test result=" << gError);
 
diff --git a/MAC/GCF/TM/test/tGCFTask1.cc b/MAC/GCF/TM/test/tGCFTask1.cc
index 0ba9a624547de4e35a57a15c4d7ab99673e3492c..61e008162b81c4c82ea109e0b48bb17ef98da47b 100644
--- a/MAC/GCF/TM/test/tGCFTask1.cc
+++ b/MAC/GCF/TM/test/tGCFTask1.cc
@@ -35,7 +35,7 @@ using namespace LOFAR::GCF;
 
 int main(int argc,	char*	argv[]) 
 {
-	GCFTask::init(argc, argv, basename(argv[0]));
+	GCFScheduler::instance()->init(argc, argv, basename(argv[0]));
 
 	LOG_INFO("THIS PROGRAM RUNS UNTIL YOU STOP IT WITH CTRL-C!!!");
 	sleep(2);
@@ -48,7 +48,7 @@ int main(int argc,	char*	argv[])
 	medium.start();
 	slow.start();
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return (0);
 }
diff --git a/MAC/GCF/TM/test/tGCFTask2.cc b/MAC/GCF/TM/test/tGCFTask2.cc
index 68a1efb9dc7acd9cc75395248b28961dbd8df3b3..756fe88bc4003d42d5ef9deda7c1764766009671 100644
--- a/MAC/GCF/TM/test/tGCFTask2.cc
+++ b/MAC/GCF/TM/test/tGCFTask2.cc
@@ -34,7 +34,7 @@ using namespace LOFAR::GCF;
 
 int main(int argc,	char*	argv[]) 
 {
-	GCFTask::init(argc, argv, basename(argv[0]));
+	GCFScheduler::instance()->init(argc, argv, basename(argv[0]));
 
 	LOG_INFO("THIS PROGRAM RUNS UNTIL YOU STOP IT WITH CTRL-C!!!");
 	sleep(2);
@@ -47,15 +47,15 @@ int main(int argc,	char*	argv[])
 	medium.start();
 	slow.start();
 
-	GCFTask::setDelayedQuit(true);
+	GCFScheduler::instance()->setDelayedQuit(true);
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	fast.quit();
 	medium.quit();
 	slow.quit();
 
-	GCFTask::run(2.0);
+	GCFScheduler::instance()->run(2.0);
 
 	return (0);
 }
diff --git a/MAC/GCF/TM/test/tGCFTask3.cc b/MAC/GCF/TM/test/tGCFTask3.cc
index 7e9b26e8c7965e02efbafdea0833c67b39c2c280..b78d6d16b8802afc3338f45d1acb2a7026b437dc 100644
--- a/MAC/GCF/TM/test/tGCFTask3.cc
+++ b/MAC/GCF/TM/test/tGCFTask3.cc
@@ -34,7 +34,7 @@ using namespace LOFAR::GCF;
 
 int main(int argc,	char*	argv[]) 
 {
-	GCFTask::init(argc, argv, basename(argv[0]));
+	GCFScheduler::instance()->init(argc, argv, basename(argv[0]));
 
 	LOG_INFO("THIS PROGRAM WILL AUTOMATICALLY QUIT AFTER 11.3 SECONDS!!!");
 	sleep(2);
@@ -47,7 +47,7 @@ int main(int argc,	char*	argv[])
 	medium.start();
 	slow.start();
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return (0);
 }
diff --git a/MAC/GCF/TM/test/tGCFTask4.cc b/MAC/GCF/TM/test/tGCFTask4.cc
index 8f80ece6a8a85bed26fc80970bb4f6ab5987d03e..957957c6833c3b1ae5d58e8bf0ccefbf2119174b 100644
--- a/MAC/GCF/TM/test/tGCFTask4.cc
+++ b/MAC/GCF/TM/test/tGCFTask4.cc
@@ -34,7 +34,7 @@ using namespace LOFAR::GCF;
 
 int main(int argc,	char*	argv[]) 
 {
-	GCFTask::init(argc, argv, basename(argv[0]));
+	GCFScheduler::instance()->init(argc, argv, basename(argv[0]));
 
 	LOG_INFO("THIS PROGRAM WILL AUTOMATICALLY QUIT AFTER 11.3 SECONDS!!!");
 	sleep(2);
@@ -47,15 +47,15 @@ int main(int argc,	char*	argv[])
 	medium.start();
 	slow.start();
 
-	GCFTask::setDelayedQuit(true);
+	GCFScheduler::instance()->setDelayedQuit(true);
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	fast.quit();
 	medium.quit();
 	slow.quit();
 
-	GCFTask::run(2.0);
+	GCFScheduler::instance()->run(2.0);
 
 	return (0);
 }
diff --git a/MAC/GCF/TM/test/tGCFTask5.cc b/MAC/GCF/TM/test/tGCFTask5.cc
index 6e2a929024351a286f6257f7de9331e195aa4c91..fa68599714699b61645400200fa5e08ca4317f37 100644
--- a/MAC/GCF/TM/test/tGCFTask5.cc
+++ b/MAC/GCF/TM/test/tGCFTask5.cc
@@ -34,7 +34,7 @@ using namespace LOFAR::GCF;
 
 int main(int argc,	char*	argv[]) 
 {
-	GCFTask::init(argc, argv, basename(argv[0]));
+	GCFScheduler::instance()->init(argc, argv, basename(argv[0]));
 
 	LOG_INFO("THIS PROGRAM WILL AUTOMATICALLY QUIT AFTER 11.3 SECONDS!!!");
 	sleep(2);
@@ -47,9 +47,9 @@ int main(int argc,	char*	argv[])
 	medium->start();
 	slow.start();
 
-	GCFTask::setDelayedQuit(true);
+	GCFScheduler::instance()->setDelayedQuit(true);
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	fast.quit();
 	LOG_INFO("Destructing the 'medium' task");
@@ -57,7 +57,7 @@ int main(int argc,	char*	argv[])
 	medium = 0;
 	slow.quit();
 
-	GCFTask::run(2.0);
+	GCFScheduler::instance()->run(2.0);
 
 	return (0);
 }
diff --git a/MAC/GCF/TM/test/tServer.cc b/MAC/GCF/TM/test/tServer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a8cb87c9d0b44cb657d10c26b75e61525d3694d2
--- /dev/null
+++ b/MAC/GCF/TM/test/tServer.cc
@@ -0,0 +1,106 @@
+//
+//  tServer.cc: Implements an echo server
+//
+//  Copyright (C) 2009
+//  ASTRON (Netherlands Foundation for Research in Astronomy)
+//  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//
+//  $Id$
+
+#include <lofar_config.h>
+#include <Common/LofarLogger.h>
+#include "tServer.h"
+#include "Echo_Protocol.ph"
+
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
+
+tServer::tServer(string name, uint	startupDelay) : 
+	GCFTask((State)&tServer::initial, name),
+	itsListener(0),
+	itsTimerPort(0),
+	itsStartupDelay(startupDelay)
+{
+	registerProtocol(ECHO_PROTOCOL, ECHO_PROTOCOL_STRINGS);
+
+	itsListener = new GCFTCPPort(*this, "Echo:Server", GCFPortInterface::SPP, ECHO_PROTOCOL);
+	ASSERTSTR(itsListener, "failed to alloc listener");
+
+	itsTimerPort = new GCFTimerPort(*this, "timerPort");
+	ASSERTSTR(itsTimerPort, "failed to alloc listener");
+}
+
+GCFEvent::TResult tServer::initial(GCFEvent& event, GCFPortInterface& port)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+
+	switch (event.signal) {
+	case F_INIT:
+		int	timerID = itsTimerPort->setTimer(1.0*itsStartupDelay);
+		LOG_DEBUG_STR("WAITING " << itsStartupDelay << " seconds before starting server, timerID=" << timerID);
+		break;
+
+    case F_TIMER:
+		LOG_DEBUG("STARTING server");
+		itsListener->open();
+		break;
+
+    case F_CONNECTED:
+		if (itsListener->isConnected()) {
+			TRAN(tServer::connected);
+		}
+		break;
+
+    case F_DISCONNECTED:
+		ASSERTSTR(false, "Bailing out because server could not be started");
+		GCFScheduler::instance()->stop();
+		break;
+
+    default:
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return (status);
+}
+
+GCFEvent::TResult tServer::connected(GCFEvent& event, GCFPortInterface& port)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+
+	switch (event.signal) {
+	case ECHO_PING: {
+		EchoPingEvent	ping(event);
+		EchoEchoEvent	echo;
+		echo.seqnr     = ping.seqnr;
+		port.send(echo);
+		break;
+	}
+
+	default:
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return (status);
+}
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
+
diff --git a/MAC/GCF/TM/test/tServer.h b/MAC/GCF/TM/test/tServer.h
new file mode 100644
index 0000000000000000000000000000000000000000..8df307a4228177e892c26294e285fb6f1eac85c1
--- /dev/null
+++ b/MAC/GCF/TM/test/tServer.h
@@ -0,0 +1,51 @@
+//
+//  tServer.h: Definition of the Echo task class.
+//
+//  Copyright (C) 2009
+//  ASTRON (Netherlands Foundation for Research in Astronomy)
+//  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//
+//  $Id$
+//
+
+#ifndef _TSERVER_H_
+#define _TSERVER_H_
+
+#include <GCF/TM/GCF_Control.h>
+
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
+
+class tServer : public GCFTask
+{
+public:
+	tServer (string name, uint	startupDelay);
+
+	GCFEvent::TResult initial  (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult connected(GCFEvent& e, GCFPortInterface& p);
+
+private:
+	GCFTCPPort* 	itsListener;
+	GCFTimerPort*	itsTimerPort;
+	uint			itsStartupDelay;
+};
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
+#endif
diff --git a/MAC/GCF/TM/test/tStateResult.cc b/MAC/GCF/TM/test/tStateResult.cc
new file mode 100644
index 0000000000000000000000000000000000000000..130f311c8f871d1effa5324225dde58b4bb2559f
--- /dev/null
+++ b/MAC/GCF/TM/test/tStateResult.cc
@@ -0,0 +1,225 @@
+//
+//  tStateResult.cc: Test program to test all kind of usage of the GCF ports.
+//
+//  Copyright (C) 2009
+//  ASTRON (Netherlands Foundation for Research in Astronomy)
+//  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//
+//  $Id$
+
+#include <lofar_config.h>
+#include <Common/LofarLogger.h>
+#include <GCF/TM/GCF_Scheduler.h>
+#include "Echo_Protocol.ph"
+#include "tStateResult.h"
+#include "tServer.h"
+
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
+
+
+// Constructors of both classes
+tStateResult::tStateResult(string name) : 
+	GCFTask     ((State)&tStateResult::initial, name),
+	itsServer	(0),
+	itsConn 	(0)
+{ 
+	registerProtocol (ECHO_PROTOCOL, ECHO_PROTOCOL_STRINGS);
+}
+
+tStateResult::~tStateResult()
+{
+}
+
+//
+// initial
+//
+// Start a server task that will open the listener after 25 second. Start an autoOpen call
+// in this taks and wait till the connection is established.
+//
+GCFEvent::TResult tStateResult::initial(GCFEvent& event, GCFPortInterface& /*port*/)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tStateResult::initial: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_INIT:
+		return (GCFEvent::HANDLED);
+
+	case F_ENTRY:
+		LOG_DEBUG("\n\n\n\nStarting the server task");
+		tServer*	itsServer = new tServer("Server", 0);
+		itsServer->start();
+		itsConn = new GCFTCPPort(*this, "Echo:Server", GCFPortInterface::SAP, ECHO_PROTOCOL, false);
+		ASSERTSTR(itsConn, "Can't allocate a TCPport");
+		itsConn->autoOpen(10, 0, 2);	// try to connect to my server
+		break;
+
+	case F_CONNECTED:
+		TRAN(tStateResult::collecting);
+		break;
+
+	case F_DISCONNECTED:
+		LOG_DEBUG_STR("HOUSTON HAVE A PROBLEM");
+		break;
+
+	case F_EXIT:
+		LOG_INFO("Deliberately returning F_EXIT as NOT_HANDLED");
+		return (GCFEvent::NOT_HANDLED);
+
+	default:
+		LOG_WARN_STR("DEFAULT in initial: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+//
+// collecting
+//
+// We send some pings to our echo server and accept some of the replies and
+// return the others as NEXT_STATE or NOT_HANDLED.
+//
+GCFEvent::TResult tStateResult::collecting(GCFEvent& event, GCFPortInterface& /*port*/)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tStateResult::collecting: " << eventName(event.signal));
+//	GCFScheduler::instance()->printEventQueue();
+
+	switch (event.signal) {
+	case F_ENTRY: {
+		LOG_DEBUG_STR("Sending ping nr 1");
+		EchoPingEvent	ping;
+		ping.seqnr=1;
+		itsConn->send(ping);
+	}
+	break;
+
+	case ECHO_ECHO: {
+		EchoEchoEvent	echo(event);
+		if (echo.seqnr % 5 == 0) {
+			LOG_DEBUG_STR("Received echo " << echo.seqnr << ", returning NOT_HANDLED");
+			status = GCFEvent::NOT_HANDLED;
+		} 
+		else if (echo.seqnr % 3 == 0) {
+			LOG_DEBUG_STR("Received echo " << echo.seqnr << ", returning NEXT_STATE");
+			status = GCFEvent::NEXT_STATE;
+		}
+		else {
+			LOG_DEBUG_STR("Received echo " << echo.seqnr << ", returning HANDLED");
+			status = GCFEvent::HANDLED;
+		}
+
+		if (echo.seqnr < 10) {
+			EchoPingEvent	ping;
+			ping.seqnr = ++echo.seqnr;
+			LOG_DEBUG_STR("Sending ping nr " << ping.seqnr);
+			itsConn->send(ping);
+		}
+		else {
+			LOG_DEBUG ("Going to the last state, expecting 3 ECHO's from this state");
+			TRAN(tStateResult::lastState);
+		}
+	}
+	break;
+
+	case F_DISCONNECTED:
+		LOG_DEBUG_STR("WE STILL HAVE A PROBLEM");
+		break;
+
+	case F_EXIT:
+		LOG_INFO("F_EXIT event in collecting");
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in collecting: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	LOG_DEBUG("EOS collecting");
+	return status;
+}
+
+//
+// lastState
+//
+// Start a server task that will open the listener after 25 second. Start an autoOpen call
+// in this taks and wait till the connection is established.
+//
+GCFEvent::TResult tStateResult::lastState(GCFEvent& event, GCFPortInterface& port)
+{
+	GCFEvent::TResult status = GCFEvent::HANDLED;
+	LOG_DEBUG_STR ("tStateResult::lastState: " << eventName(event.signal));
+
+	switch (event.signal) {
+	case F_ENTRY:
+		break;
+
+	case ECHO_ECHO: {
+		EchoEchoEvent	echo(event);
+		LOG_DEBUG_STR("Received postponed ECHO nr " << echo.seqnr);
+		if (echo.seqnr < 9) {
+			return (GCFEvent::HANDLED);
+		}
+		LOG_DEBUG("Program ran succesfully");
+		GCFScheduler::instance()->stop();
+		break;
+	}
+
+	case F_DISCONNECTED:
+		LOG_DEBUG_STR("WE STILL HAVE A PROBLEM");
+		break;
+
+	case F_EXIT:
+		LOG_INFO("F_EXIT event in lastState");
+		break;
+
+	default:
+		LOG_WARN_STR("DEFAULT in lastState: " << eventName(event));
+		status = GCFEvent::NOT_HANDLED;
+		break;
+	}
+
+	return status;
+}
+
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
+
+using namespace LOFAR::GCF::TM;
+
+//
+// MAIN()
+//
+int main(int argc, char* argv[])
+{
+	GCFScheduler*	theScheduler(GCFScheduler::instance());
+	theScheduler->init(argc, argv);
+
+	tStateResult	clientTask("clientTask");
+	clientTask.start(); // make initial transition
+
+	theScheduler->run();
+
+	return (0);
+}
diff --git a/MAC/GCF/TM/test/tStateResult.h b/MAC/GCF/TM/test/tStateResult.h
new file mode 100644
index 0000000000000000000000000000000000000000..82062f7586c42b8beb88f465ba0070e9f84c3996
--- /dev/null
+++ b/MAC/GCF/TM/test/tStateResult.h
@@ -0,0 +1,58 @@
+//
+//  tStateResult.h: Test program to test all kind of usage of the GCF ports.
+//
+//  Copyright (C) 2006
+//  ASTRON (Netherlands Foundation for Research in Astronomy)
+//  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+//
+//  This program 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.
+//
+//  This program 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 this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//
+//  $Id$
+//
+
+#ifndef _TSTATE_RESULT_H_
+#define _TSTATE_RESULT_H_
+
+#include <GCF/TM/GCF_Control.h>
+
+namespace LOFAR {
+ namespace GCF {
+  namespace TM {
+
+//
+// Test if the framework responds in the right way on the return state
+// that is returned by the task states.
+//
+
+class tStateResult : public GCFTask
+{
+public:
+	tStateResult (string name);
+	~tStateResult();
+
+	// The test states
+	GCFEvent::TResult initial 	 (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult collecting (GCFEvent& e, GCFPortInterface& p);
+	GCFEvent::TResult lastState	 (GCFEvent& e, GCFPortInterface& p);
+
+private:
+	GCFTCPPort*		itsServer;
+	GCFTCPPort*		itsConn;
+};
+
+  } // namespace TM
+ } // namespace GCF
+} // namespace LOFAR
+#endif
diff --git a/MAC/GCF/TM/test/tTimer.cc b/MAC/GCF/TM/test/tTimer.cc
index b40b14a4b2dec201f250ea3259408c8ecbb10e43..aef32b12ee275ad9321386bf2ca817011d38f472 100644
--- a/MAC/GCF/TM/test/tTimer.cc
+++ b/MAC/GCF/TM/test/tTimer.cc
@@ -112,7 +112,7 @@ GCFEvent::TResult tTimer::test1(GCFEvent& event, GCFPortInterface& /*port*/)
 				LOG_DEBUG_STR("ID = " << timerEvent.id << ", *arg = " << (char*)timerEvent.arg);
 				if (gTest++ > 20) {
 					itsTimerPort->cancelTimer(gTimerID);
-					stop();
+					GCFScheduler::instance()->stop();
 				}
 			}
 			break;
@@ -140,13 +140,13 @@ using namespace LOFAR::GCF::TM;
 //
 int main(int argc, char* argv[])
 {
-	GCFTask::init(argc, argv);
+	GCFScheduler::instance()->init(argc, argv);
 
 	tTimer	timerTask("TimerTask");
 
 	timerTask.start(); // make initial transition
 
-	GCFTask::run();
+	GCFScheduler::instance()->run();
 
 	return (0);
 }
diff --git a/MAC/GCF/TM/test/testTask.cc b/MAC/GCF/TM/test/testTask.cc
index b49a679beeb2908ac35fa00cf6bfecde50f06301..654dcd5a4ab88713b243a22693622ea0c1964866 100644
--- a/MAC/GCF/TM/test/testTask.cc
+++ b/MAC/GCF/TM/test/testTask.cc
@@ -25,10 +25,12 @@
 
 //# Includes
 #include <Common/LofarLogger.h>
+#include <GCF/TM/GCF_Protocols.h>
 #include "testTask.h"
 
 namespace LOFAR {
   namespace GCF {
+    namespace TM {
 
 //
 // testTask(name, timerInterval)
@@ -80,7 +82,7 @@ GCFEvent::TResult	testTask::mainTask(GCFEvent&	event, GCFPortInterface&	port)
 			GCFTimerEvent&		timerEvent = static_cast<GCFTimerEvent&>(event);
 			if (timerEvent.id == itsStopTimer) {
 				LOG_INFO("STOPTIMER EXPIRED, CALLING STOP()");
-				stop();
+				GCFScheduler::instance()->stop();
 			}
 		}
 		break;
@@ -114,5 +116,6 @@ GCFEvent::TResult	testTask::mainTask(GCFEvent&	event, GCFPortInterface&	port)
 	return (GCFEvent::HANDLED);
 }
 
+	} // namespace TM
   } // namespace GCF
 } // namespace LOFAR
diff --git a/MAC/GCF/TM/test/testTask.h b/MAC/GCF/TM/test/testTask.h
index 484119a4f1b9d7b000953df26bb5d143181dcca3..e96f56781b25c7b2560ba2c6bbed214a6c6f4f9c 100644
--- a/MAC/GCF/TM/test/testTask.h
+++ b/MAC/GCF/TM/test/testTask.h
@@ -39,6 +39,7 @@ namespace LOFAR {
   using GCF::TM::GCFTask;
   using GCF::TM::GCFPortInterface;
   namespace GCF {
+	namespace TM {
 
 // \addtogroup GCF
 // @{
@@ -69,6 +70,7 @@ private:
 };
 
 // @}
+    } // namespace TM
   } // namespace GCF
 } // namespace LOFAR
 
diff --git a/MAC/MACIO/include/MACIO/GCF_Event.h b/MAC/MACIO/include/MACIO/GCF_Event.h
index 57d183e83466fdd1333edc358d656f79c5703187..05251e7b7cd203cfd37d0bc950f8abd47d2ae57e 100644
--- a/MAC/MACIO/include/MACIO/GCF_Event.h
+++ b/MAC/MACIO/include/MACIO/GCF_Event.h
@@ -71,8 +71,9 @@ public:
 	/// result of a dispatch action
 	enum TResult { 
 		ERROR = -1, 
-		HANDLED = 0, 
-		NOT_HANDLED = 1
+		HANDLED, 
+		NOT_HANDLED,
+		NEXT_STATE
 	};
 
 	// packs all fields of the event into the event buffer and returns its 
@@ -80,7 +81,7 @@ public:
 	virtual void* pack(uint32& packsize);
 
 	// Make a copy of the event
-	GCFEvent* clone();
+	GCFEvent* clone() const;
 
 protected:
 	// special constructor it will be call by the specialised "unpack"- 
diff --git a/MAC/MACIO/src/GCF_Event.cc b/MAC/MACIO/src/GCF_Event.cc
index bd3ada980b0aa896c2e9cd7b47ae05bcba7108a0..777570fb6978c06be4765f05051fdb57c6fa3eb0 100644
--- a/MAC/MACIO/src/GCF_Event.cc
+++ b/MAC/MACIO/src/GCF_Event.cc
@@ -61,19 +61,13 @@ void GCFEvent::resizeBuf(uint32 requiredSize)
   length = requiredSize - sizeof(length) - sizeof(signal);
 }
 
-GCFEvent* GCFEvent::clone()
+GCFEvent* GCFEvent::clone() const
 {
 	int		mySize = sizeof(GCFEvent) + length;
 	char* 	theClone = new char[mySize];
 	memcpy(theClone, (const char*)this, mySize);
 
-//	string	hd;
-//	hexdump(hd, this, mySize);
-//	LOG_DEBUG(hd);
-	LOG_DEBUG_STR("The clone is " << mySize << " bytes");
-//	hd.clear();
-//	hexdump(hd, theClone, mySize);
-//	LOG_DEBUG(hd);
+	LOG_TRACE_CALC_STR("The clone is " << mySize << " bytes");
 
 	return ((GCFEvent*) theClone);
 }