diff --git a/MAC/APL/APLCommon/configure.in b/MAC/APL/APLCommon/configure.in
index f6eb4eede1c2ea7e75b3fa20680073e9b2014a17..b274f024f23be1440c47bed59b7012b0ac97dc1a 100644
--- a/MAC/APL/APLCommon/configure.in
+++ b/MAC/APL/APLCommon/configure.in
@@ -56,10 +56,10 @@ lofar_GENERAL
 lofar_COMPILETOOLS
 lofar_PVSS(1)
 lofar_INTERNAL(LCS/Common, common, LCS-Common-2_3, 1, Common/LofarTypes.h,,)
-lofar_INTERNAL(LCS/ACC/APS, APS, LCS-ACC-2_0, 1, APS/ParameterSet.h,,)
-lofar_INTERNAL(MAC/GCF/TM, GCFTM, MAC-GCF-6_0, 1, GCF/TM/GCF_Control.h,,)
-lofar_INTERNAL(MAC/GCF/GCFCommon, GCFCommon, MAC-GCF-6_0, 1, GCF/GCF_Defines.h,,)
-lofar_INTERNAL(MAC/GCF/PAL, GCFPAL, MAC-GCF-6_0, 1, GCF/PAL/GCF_Property.h,,)
+lofar_INTERNAL(LCS/ACC/APS, APS, , 1, APS/ParameterSet.h,,)
+lofar_INTERNAL(MAC/GCF/TM, GCFTM, , 1, GCF/TM/GCF_Control.h,,)
+lofar_INTERNAL(MAC/GCF/GCFCommon, GCFCommon, , 1, GCF/GCF_Defines.h,,)
+lofar_INTERNAL(MAC/GCF/PAL, GCFPAL, , 1, GCF/PAL/GCF_Property.h,,)
 lofar_EXTERNAL(boost, 1, boost/shared_ptr.hpp, "")
 
 dnl
diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/APLUtilities.h b/MAC/APL/APLCommon/include/APL/APLCommon/APLUtilities.h
index 11187bd87578275fbe0c2fe62f07861e75b98a5b..4827f2a12c0bfe5db9a5b18f5f147676bb21c343 100644
--- a/MAC/APL/APLCommon/include/APL/APLCommon/APLUtilities.h
+++ b/MAC/APL/APLCommon/include/APL/APLCommon/APLUtilities.h
@@ -36,39 +36,55 @@
 
 // forward declaration
 
-namespace LOFAR
-{
-  
-namespace APLCommon
-{
+namespace LOFAR { 
+  namespace APLCommon {
 
 class APLUtilities
 {
-  public:
+public:
 
     APLUtilities(); 
     virtual ~APLUtilities();
 
-    static void decodeCommand(const string& commandString, string& command, vector<string>& parameters,const char delimiter=',');
-    static void string2Vector(const string& parametersString, vector<string>& parameters, const char delimiter=','); 
-    static void string2Vector(const string& parametersString, vector<int>& parameters, const char delimiter=','); 
-    static void string2Vector(const string& parametersString, vector<int16>& parameters, const char delimiter=','); 
-    static void vector2String(const vector<int16>& parameters, string& parametersString, const char delimiter=','); 
-    static time_t getUTCtime();
-    static time_t decodeTimeString(const string& timeStr);
-    static int remoteCopy(const string& localFile, const string& remoteHost, const string& remoteFile);
-    static string getTempFileName();
-    static TLogicalDeviceTypes convertLogicalDeviceType(const string& ldTypeString);
-    
-  protected:
+	// Break a PVSS commandstring into a command with args
+    static void		decodeCommand (const string& commandString, 
+								   string& command, 
+								   vector<string>& parameters,
+								   const char delimiter=',');
+
+	// Break a ParameterSet array into a vector of values.
+    static void		string2Vector (const string& parametersString, 
+								   vector<string>& parameters, 
+								   const char delimiter=','); 
+    static void		string2Vector (const string& parametersString, 
+								   vector<int>& parameters, 
+								   const char delimiter=','); 
+    static void		string2Vector (const string& parametersString, 
+								   vector<int16>& parameters, 
+								   const char delimiter=','); 
+	
+	// Construct a ParameterSet array from a vector of strings
+    static void		vector2String (const vector<int16>& parameters, 
+								   string& parametersString, 
+								   const char delimiter=','); 
+
+	// time utilities
+    static time_t	getUTCtime();
+    static time_t	decodeTimeString(const string& timeStr);
+
+	// Copy file to remote machine
+    static int		remoteCopy	  (const string& localFile, 
+								   const string& remoteHost, 
+								   const string& remoteFile);
+    static string	getTempFileName(const string&	format="");
+
+protected:
     // protected copy constructor
     APLUtilities(const APLUtilities&);
     // protected assignment operator
     APLUtilities& operator=(const APLUtilities&);
 
-  private:
-
-    ALLOC_TRACER_CONTEXT  
+private:
 };
 
 };//APL
diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/APL_Defines.h b/MAC/APL/APLCommon/include/APL/APLCommon/APL_Defines.h
index 8a7dee4d84ac752aec6c68629b1d079cb4b38f8a..92a8a4512e1d429ca6980fb2b1420a67636a2c2f 100644
--- a/MAC/APL/APLCommon/include/APL/APLCommon/APL_Defines.h
+++ b/MAC/APL/APLCommon/include/APL/APLCommon/APL_Defines.h
@@ -23,11 +23,10 @@
 #ifndef APL_DEFINES_H
 #define APL_DEFINES_H
 
-namespace LOFAR
-{
-  
-namespace APLCommon
-{
+namespace LOFAR { 
+namespace APLCommon {
+
+#define	LOFAR_SHARE_LOCATION	"/opt/lofar/share"
 
   enum TLDResult
   {
@@ -45,7 +44,6 @@ namespace APLCommon
     LD_RESULT_SETCLOCKS_ERROR, // error setting td clocks
     LD_RESULT_STARTCAL_ERROR,  // error starting calibration
     LD_RESULT_LOW_PRIORITY,    // a higher priority LD caused a suspend of this LD
-
   };
 
   enum 
@@ -58,36 +56,19 @@ namespace APLCommon
     RS_SUSPECT_IDLE = 0x40000000
   };
 
-  enum TLogicalDeviceTypes 
-  {
-    LDTYPE_NO_TYPE = 0, 
-    LDTYPE_VIRTUALINSTRUMENT = 1, 
-    LDTYPE_VIRTUALTELESCOPE, 
-    LDTYPE_ARRAYRECEPTORGROUP, 
-    LDTYPE_STATIONRECEPTORGROUP, 
-    LDTYPE_ARRAYOPERATIONS, 
-    LDTYPE_STATIONOPERATIONS, 
-    LDTYPE_VIRTUALBACKEND, 
-    LDTYPE_MAINTENANCEVI,
-    LDTYPE_OBSERVATION,
-    LDTYPE_VIRTUALROUTE
-  };
+// Define mnemonics for the supported controller. These names are used
+// to tell LDStartDaemon which program should be started.
+#define	LDTYPE_NO_TYPE				"UNDEFINED"
+#define	LDTYPE_OBSERVATIONCTRL		"OBS_CTRL"
+#define	LDTYPE_BEAMDIRECTIONCTRL	"BEAMDIR_CTRL"
+#define	LDTYPE_GROUPCTRL			"GROUP_CTRL"
+#define	LDTYPE_STATIONCTRL			"STS_CTRL"
+#define	LDTYPE_DIGITALBOARDCTRL		"DIGBOARD_CTRL"
+#define	LDTYPE_BEAMCTRL				"BEAM_CTRL"
+#define	LDTYPE_CALIBRATIONCTRL		"CAL_CTRL"
+#define	LDTYPE_STATIONINFRACTRL		"STSINFRA_CTRL"
+
 
-  enum TSDResult
-  {
-    SD_RESULT_NO_ERROR = 0, 
-    SD_RESULT_UNSPECIFIED_ERROR, 
-    SD_RESULT_UNSUPPORTED_LD, 
-    SD_RESULT_FILENOTFOUND,
-    SD_RESULT_PARAMETERNOTFOUND,
-    SD_RESULT_INCORRECT_NUMBER_OF_PARAMETERS,
-    SD_RESULT_UNKNOWN_COMMAND,
-    SD_RESULT_ALREADY_EXISTS,
-    SD_RESULT_LD_NOT_FOUND,
-    SD_RESULT_WRONG_STATE,
-    SD_RESULT_SHUTDOWN,
-    SD_RESULT_WRONG_VERSION,
-  };
 
   #define IS_BUSY(s) ((s > 0) && (s != RS_SUSPECT_IDLE))
   #define IS_SUSPECT(s) (s >= RS_SUSPECT_IDLE)
@@ -95,8 +76,7 @@ namespace APLCommon
   #define MAKE_SUSPECT(s) (s |= RS_SUSPECT_IDLE)
   #define MAKE_UNSUSPECT(s) (s &= ~RS_SUSPECT_IDLE)
 
-};
-
-};
+};	// APLCommon
+}; // LOFAR
 
 #endif
diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/LogicalDevice.h b/MAC/APL/APLCommon/include/APL/APLCommon/LogicalDevice.h
index f38270d0afb5227353b9ffeababaaa4077fd3ced..dfe6f8395364a9633533cb2851bf8e0fc57308ef 100644
--- a/MAC/APL/APLCommon/include/APL/APLCommon/LogicalDevice.h
+++ b/MAC/APL/APLCommon/include/APL/APLCommon/LogicalDevice.h
@@ -24,6 +24,7 @@
 #define LogicalDevice_H
 
 //# Includes
+#define BOOST_SP_USE_PTHREADS
 #include <boost/shared_ptr.hpp>
 #include <boost/weak_ptr.hpp>
 #include <boost/enable_shared_from_this.hpp>
@@ -177,7 +178,7 @@ namespace APLCommon
       typedef map<string,TPortSharedPtr>      TPortMap;
       typedef map<string,TPortWeakPtr>        TPortWeakPtrMap;
       typedef vector<TBufferedEventInfo>      TEventBufferVector;
-      typedef map<string,TLogicalDeviceTypes> TString2LDTypeMap;
+//      typedef map<string,TLogicalDeviceTypes> TString2LDTypeMap;
       typedef map<string,TLogicalDeviceState> TString2LDStateMap;
       
       /**
@@ -188,8 +189,8 @@ namespace APLCommon
       bool _isChildPort(GCF::TM::GCFPortInterface& port);
       bool _isChildStartDaemonPort(GCF::TM::GCFPortInterface& port, string& startDaemonKey);
       void _sendToAllChilds(GCFEventSharedPtr eventPtr);
-      bool _childsInState(const double requiredPercentage, const TLogicalDeviceTypes& type, const TLogicalDeviceState& state);
-      bool _childsNotInState(const double requiredPercentage, const TLogicalDeviceTypes& type, const TLogicalDeviceState& state);
+      bool _childsInState(const double requiredPercentage, const string& type, const TLogicalDeviceState& state);
+      bool _childsNotInState(const double requiredPercentage, const string& type, const TLogicalDeviceState& state);
       void _connectedHandler(GCF::TM::GCFPortInterface& port);
       void _disconnectedHandler(GCF::TM::GCFPortInterface& port);
       void _acceptChildConnection();
@@ -246,7 +247,7 @@ namespace APLCommon
       std::string                           m_basePropertySetName;
       GCFMyPropertySetSharedPtr             m_detailsPropertySet;
       std::string                           m_detailsPropertySetName;
-      ACC::APS::ParameterSet                m_parameterSet;
+      ACC::APS::ParameterSet*               m_parameterSet;
 
       string                                m_serverPortName;
       TRemotePort                           m_serverPort; // listening port
@@ -294,7 +295,7 @@ namespace APLCommon
       TLDResult                             m_globalError;
       const string                          m_version;
 
-      TString2LDTypeMap                     m_childTypes;
+//      TString2LDTypeMap                     m_childTypes;
       TString2LDStateMap                    m_childStates;
       
       ResourceAllocator::ResourceAllocatorPtr m_resourceAllocator;
diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/LogicalDeviceFactory.h b/MAC/APL/APLCommon/include/APL/APLCommon/LogicalDeviceFactory.h
index dba540a827dd14855cb90313b3fef21b3d77ec5a..b2b76c8bc3d494013b5c973aae33423a281c7b8e 100644
--- a/MAC/APL/APLCommon/include/APL/APLCommon/LogicalDeviceFactory.h
+++ b/MAC/APL/APLCommon/include/APL/APLCommon/LogicalDeviceFactory.h
@@ -32,40 +32,38 @@
 
 // forward declaration
 
-namespace LOFAR
-{
-  
-namespace APLCommon
-{
-  template <class T>
-    class LogicalDeviceFactory : public LogicalDeviceFactoryBase
-  {
-    public:
+namespace LOFAR {
+  namespace APLCommon {
 
-      LogicalDeviceFactory() : LogicalDeviceFactoryBase() {}; 
-      virtual ~LogicalDeviceFactory() {};
+template <class T>
+class LogicalDeviceFactory : public LogicalDeviceFactoryBase
+{
+public:
+	// Constructors and Destructors
+	LogicalDeviceFactory() : LogicalDeviceFactoryBase() {}; 
+   	virtual ~LogicalDeviceFactory() {};
       
-      virtual boost::shared_ptr<LogicalDevice> createLogicalDevice(const string& taskName, 
-                                                                   const string& parameterFile,
-                                                                   GCF::TM::GCFTask* pStartDaemon)
-      {
-        return boost::shared_ptr<LogicalDevice>(new T(taskName, parameterFile, pStartDaemon));
-      };
+   	virtual boost::shared_ptr<LogicalDevice> createLogicalDevice(const string& taskName, 
+																 const string& parameterFile,
+																 GCF::TM::GCFTask* pStartDaemon)
+	{
+		return boost::shared_ptr<LogicalDevice>(new T(taskName, parameterFile, pStartDaemon));
+	};
 
-      virtual bool sharingAllowed()
-      {
-        return false;
-      }
+	virtual bool sharingAllowed() {
+		return (false);
+   	}
 
-    protected:
-      // protected copy constructor
-      LogicalDeviceFactory(const LogicalDeviceFactory&);
-      // protected assignment operator
-      LogicalDeviceFactory& operator=(const LogicalDeviceFactory&);
+protected:
+	// protected copy constructor
+	LogicalDeviceFactory(const LogicalDeviceFactory&);
+	// protected assignment operator
+	LogicalDeviceFactory& operator=(const LogicalDeviceFactory&);
 
-    private:
+private:
     
-  };
+};
+
 };//APLCommon
 };//LOFAR
 #endif
diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/LogicalDeviceFactoryBase.h b/MAC/APL/APLCommon/include/APL/APLCommon/LogicalDeviceFactoryBase.h
index 8a5820192c2127b51136fe89aa362fa5d8888574..4e9d73f7e6ca4c3279679f33d6c96740bbd86f96 100644
--- a/MAC/APL/APLCommon/include/APL/APLCommon/LogicalDeviceFactoryBase.h
+++ b/MAC/APL/APLCommon/include/APL/APLCommon/LogicalDeviceFactoryBase.h
@@ -24,6 +24,7 @@
 #define LogicalDeviceFactoryBase_H
 
 //# Includes
+#define BOOST_SP_USE_PTHREADS
 #include <boost/shared_ptr.hpp>
 
 //# local includes
@@ -32,40 +33,39 @@
 //# Common Includes
 #include <GCF/TM/GCF_Task.h>
 
+
+namespace LOFAR {
+  namespace APLCommon {
+
 // forward declaration
+class LogicalDevice;
 
-namespace LOFAR
-{
-  
-namespace APLCommon
+class LogicalDeviceFactoryBase
 {
-  class LogicalDevice;
+public:
+	// Constructor and desctuctor
+	LogicalDeviceFactoryBase() {}; 
+	virtual ~LogicalDeviceFactoryBase() {};
+      
+	// The factory call.
+	virtual boost::shared_ptr<LogicalDevice> createLogicalDevice(const string& taskName, 
+																 const string& parameterFile,
+																 GCF::TM::GCFTask* pStartDaemon)=0;
 
-  class LogicalDeviceFactoryBase
-  {
-    public:
+	virtual bool sharingAllowed() {
+		return (false);
+	}
 
-      LogicalDeviceFactoryBase() {}; 
-      virtual ~LogicalDeviceFactoryBase() {};
-      
-      virtual boost::shared_ptr<LogicalDevice> createLogicalDevice(const string& taskName, 
-                                                                   const string& parameterFile,
-                                                                   GCF::TM::GCFTask* pStartDaemon)=0;
-      virtual bool sharingAllowed()
-      {
-        return false;
-      }
+protected:
+	// protected copy constructor
+	LogicalDeviceFactoryBase(const LogicalDeviceFactoryBase&);
+	// protected assignment operator
+	LogicalDeviceFactoryBase& operator=(const LogicalDeviceFactoryBase&);
 
-    protected:
-      // protected copy constructor
-      LogicalDeviceFactoryBase(const LogicalDeviceFactoryBase&);
-      // protected assignment operator
-      LogicalDeviceFactoryBase& operator=(const LogicalDeviceFactoryBase&);
+private:
+	ALLOC_TRACER_CONTEXT  
+};
 
-    private:
-    
-      ALLOC_TRACER_CONTEXT  
-  };
 };//APLCommon
 };//LOFAR
 #endif
diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/Makefile.am b/MAC/APL/APLCommon/include/APL/APLCommon/Makefile.am
index 8f30f32cb33e5202e849adbcb52d842bdac1e99f..015f9752d9e503cf077c185748e6c063e376a115 100644
--- a/MAC/APL/APLCommon/include/APL/APLCommon/Makefile.am
+++ b/MAC/APL/APLCommon/include/APL/APLCommon/Makefile.am
@@ -12,8 +12,7 @@ pkginclude_HEADERS = \
 	PropertySetAnswerHandlerInterface.h \
 	SharedLogicalDeviceFactory.h \
 	SingleInstanceLogicalDeviceFactory.h \
-	ResourceAllocator.h \
-	StartDaemon.h
+	ResourceAllocator.h 
 
 NOINSTHDRS =
 
diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/PropertySetAnswer.h b/MAC/APL/APLCommon/include/APL/APLCommon/PropertySetAnswer.h
index cb2145ef144d0243b04d8bda4d9ec9c502671b09..b31ca476adb9b53d99f161587fb6f162131bfc55 100644
--- a/MAC/APL/APLCommon/include/APL/APLCommon/PropertySetAnswer.h
+++ b/MAC/APL/APLCommon/include/APL/APLCommon/PropertySetAnswer.h
@@ -58,8 +58,6 @@ namespace APLCommon
   
     private:    
       PropertySetAnswerHandlerInterface& m_handler;
-
-      ALLOC_TRACER_CONTEXT  
   };
 };//APLCommon
 };//LOFAR
diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/PropertySetAnswerHandlerInterface.h b/MAC/APL/APLCommon/include/APL/APLCommon/PropertySetAnswerHandlerInterface.h
index 4ff3231d5fb7c3facc5205b6977bee151441872b..25b7c8f7e05933e48ebee0f7e54fdd7e0647bc60 100644
--- a/MAC/APL/APLCommon/include/APL/APLCommon/PropertySetAnswerHandlerInterface.h
+++ b/MAC/APL/APLCommon/include/APL/APLCommon/PropertySetAnswerHandlerInterface.h
@@ -57,8 +57,6 @@ namespace APLCommon
       PropertySetAnswerHandlerInterface& operator=(const PropertySetAnswerHandlerInterface&);
   
     private:
-    
-      ALLOC_TRACER_CONTEXT  
   };
 };//APLCommon
 };//LOFAR
diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/ResourceAllocator.h b/MAC/APL/APLCommon/include/APL/APLCommon/ResourceAllocator.h
index 7eb85026a8a3071916125a70ab61527434f3b98d..0c5ca9b54dcf7bbbf91ea35320d65eff8c3ba427 100644
--- a/MAC/APL/APLCommon/include/APL/APLCommon/ResourceAllocator.h
+++ b/MAC/APL/APLCommon/include/APL/APLCommon/ResourceAllocator.h
@@ -23,6 +23,7 @@
 #ifndef RESOURCEALLOCATOR_H
 #define RESOURCEALLOCATOR_H
 
+#define BOOST_SP_USE_PTHREADS
 #include <boost/shared_ptr.hpp>
 #include <set>
 #include <bitset>
diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/StartDaemon.h b/MAC/APL/APLCommon/include/APL/APLCommon/StartDaemon.h
deleted file mode 100644
index a97616884b8fe170bcfb63aa70f63306ef119a45..0000000000000000000000000000000000000000
--- a/MAC/APL/APLCommon/include/APL/APLCommon/StartDaemon.h
+++ /dev/null
@@ -1,130 +0,0 @@
-//#  StartDaemon.h: Server class that creates Logical Devices upon request.
-//#
-//#  Copyright (C) 2002-2005
-//#  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 StartDaemon_H
-#define StartDaemon_H
-
-//# Includes
-#include <boost/shared_ptr.hpp>
-
-//# GCF Includes
-#include <GCF/PAL/GCF_MyPropertySet.h>
-#include <GCF/PAL/GCF_PVSSPort.h>
-#include <GCF/TM/GCF_TCPPort.h>
-#include <GCF/TM/GCF_Task.h>
-#include <GCF/TM/GCF_Event.h>
-
-//# Common Includes
-#include <Common/lofar_map.h>
-#include <Common/lofar_vector.h>
-#include <Common/lofar_string.h>
-
-//# local includes
-#include "APL/APLCommon/PropertySetAnswerHandlerInterface.h"
-#include "APL/APLCommon/PropertySetAnswer.h"
-
-#include "APL/APLCommon/APL_Defines.h"
-
-// forward declaration
-
-namespace LOFAR
-{
-  
-namespace APLCommon
-{
-  class LogicalDevice;
-  class LogicalDeviceFactoryBase;
-  
-  class StartDaemon : public GCF::TM::GCFTask,
-                             PropertySetAnswerHandlerInterface
-  {
-    public:
-    
-      static const string PSTYPE_STARTDAEMON;
-      static const string SD_PROPNAME_COMMAND;
-      static const string SD_PROPNAME_STATUS;
-      static const string SD_COMMAND_SCHEDULE;
-      static const string SD_COMMAND_DESTROY_LOGICALDEVICE;
-      static const string SD_COMMAND_STOP;
-
-      StartDaemon(const string& name); 
-      virtual ~StartDaemon();
-      
-      void registerFactory(TLogicalDeviceTypes ldType, boost::shared_ptr<LogicalDeviceFactoryBase> factory);
-      TSDResult createLogicalDevice(const TLogicalDeviceTypes ldType, const string& taskName, const string& fileName);
-      TSDResult destroyLogicalDevice(const string& name);
-      
-
-      /**
-      * The initial state handler. This handler is passed to the GCFTask constructor
-      * to indicate that the F_INIT event which starts the state machine is handled
-      * by this handler.
-      * @param e The event that was received and needs to be handled by the state
-      * handler.
-      * @param p The port interface (see @a GCFPortInterface) on which the event
-      * was received.
-      */
-      GCF::TM::GCFEvent::TResult initial_state(GCF::TM::GCFEvent& e, GCF::TM::GCFPortInterface& p);
-
-      /**
-      * The idle state handler. 
-      */
-      GCF::TM::GCFEvent::TResult idle_state(GCF::TM::GCFEvent& e, GCF::TM::GCFPortInterface& p);
-
-      virtual void handlePropertySetAnswer(GCF::TM::GCFEvent& answer);
-
-    protected:
-      // protected copy constructor
-      StartDaemon(const StartDaemon&);
-      // protected assignment operator
-      StartDaemon& operator=(const StartDaemon&);
-
-    private:
-      bool _isServerPort(GCF::TM::GCFPortInterface& port);
-      bool _isChildPort(GCF::TM::GCFPortInterface& port);
-      void _disconnectedHandler(GCF::TM::GCFPortInterface& port);
-
-#ifndef USE_PVSSPORT
-      typedef GCF::TM::GCFTCPPort  TThePortTypeInUse;
-#else      
-      typedef GCF::PAL::GCFPVSSPort TThePortTypeInUse;
-#endif
-      typedef map<TLogicalDeviceTypes,boost::shared_ptr<LogicalDeviceFactoryBase> > TFactoryMap;
-      typedef map<string,boost::shared_ptr<LogicalDevice> > TLogicalDeviceMap;
-      typedef vector<boost::shared_ptr<TThePortTypeInUse> > TPortVector;
-
-      PropertySetAnswer               m_propertySetAnswer;
-      GCF::PAL::GCFMyPropertySet      m_properties;
-      string                          m_serverPortName;
-      TThePortTypeInUse               m_serverPort; // listening port
-      TPortVector                     m_childPorts;    // connected childs
-
-      TFactoryMap                     m_factories;
-      TLogicalDeviceMap               m_logicalDevices;
-      TLogicalDeviceMap               m_garbageCollection;
-      unsigned long                   m_garbageCollectionTimerId;
-    
-      ALLOC_TRACER_CONTEXT  
-  };
-};//APLCommon
-};//LOFAR
-#endif
diff --git a/MAC/APL/APLCommon/src/APLUtilities.cc b/MAC/APL/APLCommon/src/APLUtilities.cc
index 2265eaeeba226a19e3d99b2285c9c5e555892b39..9ecd8127588e2fb5aa37362d644b7f1be864df31 100644
--- a/MAC/APL/APLCommon/src/APLUtilities.cc
+++ b/MAC/APL/APLCommon/src/APLUtilities.cc
@@ -19,19 +19,16 @@
 //#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 //#
 //#  $Id$
-#undef PACKAGE
-#undef VERSION
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <unistd.h>
 
-#include <Common/lofar_strstream.h>
+//#include <Common/lofar_strstream.h>
 #include "APL/APLCommon/APLUtilities.h"
 
 using namespace LOFAR;
 using namespace APLCommon;
 
-INIT_TRACER_CONTEXT(APLUtilities,LOFARLOGGER_PACKAGE);
-
 APLUtilities::APLUtilities()
 {
 }
@@ -41,18 +38,19 @@ APLUtilities::~APLUtilities()
 {
 }
 
-void APLUtilities::decodeCommand(const string& commandString, string& command, vector<string>& parameters, const char delimiter)
+void APLUtilities::decodeCommand(const string&		commandString, 
+								 string& 			command, 
+								 vector<string>&	parameters, 
+								 const char 		delimiter)
 {
-  unsigned int delim=commandString.find(' ');
-  if(delim==string::npos) // no space found
-  {
-    command=commandString;
-  }
-  else
-  {
-    command=commandString.substr(0,delim);
-    APLUtilities::string2Vector(commandString.substr(delim+1),parameters,delimiter);
-  }
+	unsigned int delim=commandString.find(' ');
+	if(delim==string::npos) { // no space found
+		command=commandString;
+	}
+	else {
+		command=commandString.substr(0,delim);
+		APLUtilities::string2Vector(commandString.substr(delim+1),parameters,delimiter);
+	}
 }
 
 /*
@@ -163,117 +161,96 @@ time_t APLUtilities::getUTCtime()
 
 time_t APLUtilities::decodeTimeString(const string& timeStr)
 {
-  // specified times are in UTC, seconds since 1-1-1970
-  time_t returnTime=APLUtilities::getUTCtime();
-  string::size_type plusPos = timeStr.find('+');
-  if(plusPos != string::npos)
-  {
-    returnTime += atoi(timeStr.substr(plusPos+1).c_str());
-  }
-  else if(timeStr.find("-1") != string::npos)
-  {
-    returnTime = INT_MAX;
-  }
-  else if(timeStr != string("0"))
-  {
-    returnTime = atoi(timeStr.c_str());
-  }
-  return returnTime;
+	// empty string or -1? -> sometime in the future
+	if (timeStr.empty() || (timeStr.find("-1") != string::npos)) {
+		return (INT_MAX);
+	}
+
+	// does string contain a +? --> add to current time.
+	string::size_type plusPos = timeStr.find('+');
+	if (plusPos != string::npos) {
+		return (APLUtilities::getUTCtime() + atoi(timeStr.substr(plusPos+1).c_str()));
+	}
+
+	// specified times are in UTC, seconds since 1-1-1970
+	time_t	theTime = atoi(timeStr.c_str());
+
+	// is time 0? return current time.
+	if (theTime == 0) {
+		return (getUTCtime());
+	}
+
+	return(atoi(timeStr.c_str()));	// return specified time.
 }
 
-int APLUtilities::remoteCopy(const string& localFile, const string& remoteHost, const string& remoteFile)
+//
+// remoteCopy(localFile, remoteHost, remoteFile)
+//
+int APLUtilities::remoteCopy (const string& localFile, 
+							  const string& remoteHost, 
+							  const string& remoteFile)
 {
-  char tempFileName [L_tmpnam];
-  tmpnam(tempFileName);
+	string		tmpResultFile(getTempFileName());
   
-  string command("scp -Bq "); // -B: batch mode; -q: no progress bar
-  command += localFile + string(" ");
-  command += remoteHost + string(":");
-  command += remoteFile;
-  command += string(" 1>&2 2> ") + string(tempFileName);
-  int result = system(command.c_str());
-  LOG_DEBUG(formatString("copy command: %s",command.c_str()));
+	// -B: batch mode; -q: no progress bar
+	string command(formatString("scp -Bq %s %s:%s 1>&2 2>%s", localFile.c_str(),
+									remoteHost.c_str(), remoteFile.c_str(),
+									tmpResultFile.c_str()));
+	// execute the command.
+	int error = system(command.c_str());
+	LOG_DEBUG(formatString("copy command: %s",command.c_str()));
 
-  if(result != 0)
-  {
-    char outputLine[200];
-    string outputString;
-    FILE* f=fopen(tempFileName,"rt");
-    if(f != NULL)
-    {
-      while(!feof(f))
-      {
-        fgets(outputLine,200,f);
-        if(!feof(f))
-          outputString+=string(outputLine);
-      }
-      fclose(f);
-      LOG_ERROR(formatString("Unable to remote copy %s to %s:%s: %s",localFile.c_str(),remoteHost.c_str(),remoteFile.c_str(),outputString.c_str(),remoteHost.c_str()));
-    }
-  }
-  else
-  {
-    LOG_INFO(formatString("Successfully copied %s to %s:%s",localFile.c_str(),remoteHost.c_str(),remoteFile.c_str()));
-  }
-  remove(tempFileName);
-  return result;
-}
+	if(error == 0) {			
+		LOG_INFO(formatString("Successfully copied %s to %s:%s",
+						localFile.c_str(),remoteHost.c_str(),remoteFile.c_str()));
+	}
+	else {
+		// an error occured, try to reconstruct the message
+		char 	outputLine[200];
+		string 	outputString;
+		FILE* 	f = fopen(tmpResultFile.c_str(),"rt");	// open file with errormsg
+		if (f == NULL) {						// oops, problems opening the file
+			LOG_ERROR(
+				formatString("Unable to remote copy %s to %s:%s: reason unknown",
+				localFile.c_str(),remoteHost.c_str(),remoteFile.c_str()));
+		}
+		else {
+			// construct the error message
+			while(!feof(f)) {
+				fgets(outputLine,200,f);
+				if(!feof(f)) {
+					outputString+=string(outputLine);
+				}
+			}
+			fclose(f);
+			LOG_ERROR(formatString("Unable to remote copy %s to %s:%s: %s",
+						localFile.c_str(),remoteHost.c_str(),remoteFile.c_str(),
+						outputString.c_str()));
+		}
+	}
 
-string APLUtilities::getTempFileName()
-{
-  char tempFileName [L_tmpnam];
-  tmpnam(tempFileName);
-  return string(tempFileName);
+	// remove the temporarely file.
+	remove(tmpResultFile.c_str());
+
+	return (error);
 }
 
-TLogicalDeviceTypes APLUtilities::convertLogicalDeviceType(const string& ldTypeString)
+//
+// getTempFileName([format])
+//
+string APLUtilities::getTempFileName(const string&	format)
 {
-  TLogicalDeviceTypes ldType = LDTYPE_NO_TYPE;
-  if(ldTypeString == "VIRTUALINSTRUMENT")
-  {
-    ldType = LDTYPE_VIRTUALINSTRUMENT;
-  }
-  else if(ldTypeString == "VIRTUALTELESCOPE")
-  {
-    ldType = LDTYPE_VIRTUALTELESCOPE;
-  }
-  else if(ldTypeString == "ARRAYRECEPTORGROUP")
-  {
-    ldType = LDTYPE_ARRAYRECEPTORGROUP;
-  }
-  else if(ldTypeString == "STATIONRECEPTORGROUP")
-  {
-    ldType = LDTYPE_STATIONRECEPTORGROUP;
-  }
-  else if(ldTypeString == "ARRAYOPERATIONS")
-  {
-    ldType = LDTYPE_ARRAYOPERATIONS;
-  }
-  else if(ldTypeString == "STATIONOPERATIONS")
-  {
-    ldType = LDTYPE_STATIONOPERATIONS;
-  }
-  else if(ldTypeString == "VIRTUALBACKEND")
-  {
-    ldType = LDTYPE_VIRTUALBACKEND;
-  }
-  else if(ldTypeString == "VIRTUALROUTE")
-  {
-    ldType = LDTYPE_VIRTUALROUTE;
-  }
-  else if(ldTypeString == "MAINTENANCEVI")
-  {
-    ldType = LDTYPE_MAINTENANCEVI;
-  }
-  else if(ldTypeString == "OBSERVATION")
-  {
-    ldType = LDTYPE_OBSERVATION;
-  }
-  else
-  {
-    ldType = static_cast<TLogicalDeviceTypes>(atoi(ldTypeString.c_str()));
-    LOG_WARN(formatString("Unknown logical device type '%s'",ldTypeString.c_str()));
-  }
-  return ldType;
+	char tempFileName [128];
+
+	if (format.find("XXXXXX", 0) != string::npos) {	// did user specify mask?
+		strcpy (tempFileName, format.c_str());		// use user-mask
+	}
+	else {
+		strcpy (tempFileName, "/tmp/MAC_APL_XXXXXX");// use default mask
+	}
+
+	mkstemp(tempFileName);							// let OS invent the name
+
+	return string(tempFileName);
 }
 
diff --git a/MAC/APL/APLCommon/src/LogicalDevice.cc b/MAC/APL/APLCommon/src/LogicalDevice.cc
index f0df10e62f13815692fe4fc5d3d04f24d6c46b24..4a78bcd344c3d45089acffa4d0fa7ccde7e4b922 100644
--- a/MAC/APL/APLCommon/src/LogicalDevice.cc
+++ b/MAC/APL/APLCommon/src/LogicalDevice.cc
@@ -19,17 +19,18 @@
 //#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 //#
 //#  $Id$
-#undef PACKAGE
-#undef VERSION
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
+#include <Common/LofarLocators.h>
 
 #include <unistd.h>
+#define BOOST_SP_USE_PTHREADS
 #include <boost/shared_array.hpp>
 #include <GCF/GCF_PVString.h>
 #include <GCF/GCF_PVInteger.h>
 #include <GCF/GCF_PVDynArr.h>
-#include <GCF/ParameterSet.h>
+#include <GCF/Utils.h>
+#include <APS/ParameterSet.h>
 #include "APL/APLCommon/APL_Defines.h"
 #include "APL/APLCommon/APLUtilities.h"
 #include "APL/APLCommon/LogicalDevice.h"
@@ -97,7 +98,7 @@ LogicalDevice::LogicalDevice(const string& taskName,
   m_basePropertySetName(),
   m_detailsPropertySet(),
   m_detailsPropertySetName(),
-  m_parameterSet(),
+  m_parameterSet(LOFAR::ACC::APS::globalParameterSet()),
   m_serverPortName(string("server")),
   m_serverPort(*this, m_serverPortName, GCFPortInterface::MSPP, LOGICALDEVICE_PROTOCOL),
   m_claimTime(0),
@@ -120,7 +121,7 @@ LogicalDevice::LogicalDevice(const string& taskName,
   m_eventBuffer(),
   m_globalError(LD_RESULT_NO_ERROR),
   m_version(version),
-  m_childTypes(),
+//  m_childTypes(),
   m_childStates(),
   m_resourceAllocator(ResourceAllocator::instance()),
   m_priority(100)
@@ -140,12 +141,15 @@ LogicalDevice::LogicalDevice(const string& taskName,
   
   string psDetailsType("");
   
-  adoptParameterFile(parameterFile);
+	// TRYOUT: every LD is a seperate program that was initialized with GCFTask::init.
+	// Therefore the ParamSet is already read in.
+	LOG_WARN_STR("TRYOUT:not adopting parameterfile: " << parameterFile);
+//  adoptParameterFile(parameterFile);
   
   try {
-    m_priority = m_parameterSet.getUint16("priority");
-    m_basePropertySetName = m_parameterSet.getString("propertysetBaseName");
-    psDetailsType = m_parameterSet.getString("propertysetDetailsType");
+    m_priority 			  = m_parameterSet->getUint16("priority");
+    m_basePropertySetName = m_parameterSet->getString("propertysetBaseName");
+    psDetailsType 		  = m_parameterSet->getString("propertysetDetailsType");
   }
   catch(Exception& e) {
     THROW(APLCommon::ParameterNotFoundException,e.message());
@@ -196,15 +200,16 @@ LogicalDevice::~LogicalDevice()
 //
 void LogicalDevice::adoptParameterFile(const string& parameterFile)
 {
-  try {
-    m_parameterSet.adoptFile(_getShareLocation() + parameterFile);
-  }
-  catch(Exception& e) {
-    THROW(APLCommon::ParameterFileNotFoundException,e.message());
-  }
-  
-  // check version number
-  LOG_WARN("Version checking not implemented: need to get the version from the node in the OTDB database");
+	try {
+		ConfigLocator		aCL;
+		m_parameterSet->adoptFile(aCL.locate(parameterFile));
+	}
+	catch(Exception& e) {
+		THROW(APLCommon::ParameterFileNotFoundException,e.message());
+	}
+
+	// check version number
+	LOG_WARN("Version checking not implemented: need to get the version from the node in the OTDB database");
 #if 0
   try {
     string receivedVersion = m_parameterSet.getString(string("versionnr"));
@@ -323,7 +328,7 @@ void LogicalDevice::handlePropertySetAnswer(GCFEvent& answer)
           // SCHEDULE <fileName>
           if(command==string(LD_COMMAND_SCHEDULE)) {
             if(parameters.size()==1) {
-              m_parameterSet.adoptFile(_getShareLocation() + parameters[0]);
+              m_parameterSet->adoptFile(_getShareLocation() + parameters[0]);
               _schedule();		// distribute claim/prepare/start/stop time to children.
             }
             else {
@@ -420,11 +425,11 @@ void LogicalDevice::handlePropertySetAnswer(GCFEvent& answer)
 //
 // Adds the specified KVpair_from_the_LD_paramterSet to the subset.
 //
-void LogicalDevice::copyParentValue(ACC::APS::ParameterSet& psSubset, const string& key)
+void LogicalDevice::copyParentValue(ParameterSet& psSubset, const string& key)
 {
-  if(m_parameterSet.find(key) != m_parameterSet.end()) {
-    psSubset.add(key,m_parameterSet.getString(key));
-  }
+	if(!m_parameterSet->isDefined(key)) {
+		psSubset.add (key, m_parameterSet->getString(key));
+	}
 }
 
 //
@@ -432,7 +437,7 @@ void LogicalDevice::copyParentValue(ACC::APS::ParameterSet& psSubset, const stri
 //
 // Dummy.
 //
-void LogicalDevice::concreteAddExtraKeys(ACC::APS::ParameterSet& /*psSubset*/)
+void LogicalDevice::concreteAddExtraKeys(ParameterSet& /*psSubset*/)
 {
   LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str());
   // do nothing
@@ -453,52 +458,60 @@ void LogicalDevice::_schedule()
 {
   LOG_TRACE_LIFETIME(TRACE_LEVEL_FLOW,getName().c_str());
   
-  // (erase and) fill the childTypes and childStates maps
-  TString2LDTypeMap  newChildTypes;
-  TString2LDStateMap newChildStates;
-  // create the childs
-  vector<string> childKeys = _getChildKeys();	// vector with childnames
-  vector<string>::iterator chIt;
-  for(chIt=childKeys.begin(); chIt!=childKeys.end();++chIt) {
-    // add new childs
-    if(m_childTypes.find(*chIt) != m_childTypes.end()) {
-	  // child(name) is known in current list, copy Type and State to new Map
-      newChildTypes[*chIt]=m_childTypes[*chIt];
-      newChildStates[*chIt]=m_childStates[*chIt];
-    }
-    else {	// child is new (compared to current map)
-      try {
-		// get <childname>.logicalDeviceType value to know its type
-		// and add the child with this info to the map.
-        string ldTypeString = m_parameterSet.getString((*chIt) + ".logicalDeviceType");
-        TLogicalDeviceTypes ldType = APLUtilities::convertLogicalDeviceType(ldTypeString);
-        newChildTypes[*chIt] = ldType;
-        newChildStates[*chIt] = LOGICALDEVICE_STATE_IDLE;
-      }
-      catch(Exception& e) {
-        LOG_FATAL(formatString("(%s) Unable to create child %s",e.message().c_str(),(*chIt).c_str()));
-      }
-    }
-  } // for
+	// (erase and) fill the childTypes and childStates maps
+	// REO: No longer translation of LDtypeName (parset) and LDtypeValue (APL_Defines).
+	//      Only strings are used now.
+//	TString2LDTypeMap  newChildTypes;
+	TString2LDStateMap newChildStates;
+
+	// create the childs
+	vector<string> childKeys = _getChildKeys();	// vector with childnames
+	vector<string>::iterator chIt;
+	for (chIt=childKeys.begin(); chIt!=childKeys.end();++chIt) {
+		// add new childs
+		if(m_childStates.find(*chIt) != m_childStates.end()) {
+			// child(name) is known in current list, copy Type and State to new Map
+			// newChildTypes[*chIt]=m_childTypes[*chIt];
+			newChildStates[*chIt]=m_childStates[*chIt];
+		}
+		else {	// child is new (compared to current map)
+			try {
+				// get <childname>.logicalDeviceType value to know its type
+				// and add the child with this info to the map.
+				string ldType = m_parameterSet->getString((*chIt) + ".logicalDeviceType");
+//				newChildTypes[*chIt] = ldType;
+				newChildStates[*chIt] = LOGICALDEVICE_STATE_IDLE;
+			}
+			catch(Exception& e) {
+				LOG_FATAL(formatString("(%s) Unable to create child %s",e.message().c_str(),(*chIt).c_str()));
+			}
+		}
+	} // for
  
-  // Finally replace current maps with the new ones.
-  m_childTypes.clear();
-  m_childStates.clear();
-  m_childTypes = newChildTypes;
-  m_childStates = newChildStates;
+	// Finally replace current maps with the new ones.
+//	m_childTypes.clear();
+	m_childStates.clear();
+//	m_childTypes = newChildTypes;
+	m_childStates = newChildStates;
 
   // adjust scheduling times
   // specified times are in UTC, seconds since 1-1-1970
   time_t timeNow = APLUtilities::getUTCtime();
-  time_t claimTime   = APLUtilities::decodeTimeString(m_parameterSet.getString("claimTime"));
-  time_t prepareTime = APLUtilities::decodeTimeString(m_parameterSet.getString("prepareTime"));
-  time_t startTime   = APLUtilities::decodeTimeString(m_parameterSet.getString("startTime"));
-  time_t stopTime    = APLUtilities::decodeTimeString(m_parameterSet.getString("stopTime"));
+  time_t claimTime   = APLUtilities::decodeTimeString(m_parameterSet->getString("claimTime"));
+  time_t prepareTime = APLUtilities::decodeTimeString(m_parameterSet->getString("prepareTime"));
+  time_t startTime   = APLUtilities::decodeTimeString(m_parameterSet->getString("startTime"));
+  time_t stopTime    = APLUtilities::decodeTimeString(m_parameterSet->getString("stopTime"));
   
   // Update the CLAIM time and timer
-  if(claimTime <= timeNow) { // claim ASAP
+  if(claimTime == INT_MAX) { // wait for signal from Parent
+	LOG_INFO("Claimtime not set, wait for command from parent");
+	m_claimTime = INT_MAX;
+    m_serverPort.cancelTimer(m_claimTimerId);
+  }
+  else if(claimTime <= timeNow) { // claim ASAP
     LOG_INFO("Claiming will be done ASAP");
     m_claimTime = 0;
+    m_serverPort.cancelTimer(m_claimTimerId);
   }
   else if((claimTime >= timeNow && claimTime < m_claimTime) || m_claimTimerId==0) {
     // timerId's can be zero if the LD has been released
@@ -519,10 +532,16 @@ void LogicalDevice::_schedule()
   }
     
   // Update the PREPARE time and timer
-  if(prepareTime <= timeNow) { 
+  if(prepareTime == INT_MAX) {
+	LOG_INFO("Preparetime not set, wait for command from parent");
+	m_prepareTime = INT_MAX;
+    m_serverPort.cancelTimer(m_prepareTimerId);
+  }
+  else if(prepareTime <= timeNow) { 
     // prepare ASAP after claiming
     LOG_INFO("Preparing will be done ASAP after claiming");
     m_prepareTime = 0;
+    m_serverPort.cancelTimer(m_prepareTimerId);
   }
   else if((prepareTime >= timeNow && prepareTime < m_prepareTime) || m_prepareTimerId==0) {
     char timeString1[200];
@@ -542,9 +561,15 @@ void LogicalDevice::_schedule()
   }
 
   // Update the START time and timer
-  if(startTime <= timeNow) {
+  if(startTime == INT_MAX) {
+	LOG_INFO("Starttime not set, wait for command from parent");
+	m_startTime = INT_MAX;
+    m_serverPort.cancelTimer(m_startTimerId);
+  }
+  else if(startTime <= timeNow) {
     LOG_INFO("Starting will be done ASAP after preparing");
     m_startTime = 0;
+    m_serverPort.cancelTimer(m_startTimerId);
   }
   else if((startTime >= timeNow && startTime < m_startTime) || m_startTimerId==0) {
     char timeString1[200];
@@ -564,7 +589,12 @@ void LogicalDevice::_schedule()
   }
 
   // Update the STOP time and timer
-  if((stopTime >= timeNow && stopTime > m_stopTime) || m_stopTimerId==0) {
+  if(stopTime == INT_MAX) {
+	LOG_INFO("Stoptime not set, wait for command from parent");
+	m_stopTime = INT_MAX;
+    m_serverPort.cancelTimer(m_stopTimerId);
+  }
+  else if((stopTime >= timeNow && stopTime > m_stopTime) || m_stopTimerId==0) {
     char timeString1[200];
     char timeString2[200];
     struct tm* tmTime=localtime(&m_stopTime);
@@ -866,32 +896,31 @@ string LogicalDevice::_getConnectedChildName(GCFPortInterface& port)
 //
 // Check if enough LD's of a specific type are in a specific state.
 //
-bool LogicalDevice::_childsInState(const double requiredPercentage, const TLogicalDeviceTypes& type, const TLogicalDeviceState& state)
+bool LogicalDevice::_childsInState(const double requiredPercentage, const string& type, const TLogicalDeviceState& state)
 {
-  double totalLDs(0.0);
-  double ldsInState(0.0);
-  
-  // Loop over childTypes map and check+count childStates.
-  for(TString2LDTypeMap::iterator typesIt = m_childTypes.begin();typesIt != m_childTypes.end();++typesIt) {
-    if(typesIt->second == type || type == LDTYPE_NO_TYPE) {
-      totalLDs += 1.0;
-      TString2LDStateMap::iterator statesIt = m_childStates.find(typesIt->first);
-      if(statesIt != m_childStates.end()) {
-        LOG_DEBUG(formatString("%s is in state %s",typesIt->first.c_str(),_state2String(statesIt->second).c_str()));
-        if(statesIt->second == state) {
-          ldsInState += 1.0;
-        }
-      }
-    }
-  }
-  
-  // Calculate %.
-  double resultingPercentage(0.0);
-  if(totalLDs > 0.0) {
-    resultingPercentage = ldsInState/totalLDs*100.0;
-  }
-  
-  return (resultingPercentage >= requiredPercentage);
+	double totalLDs(0.0);
+	double ldsInState(0.0);
+
+	// Loop over childTypes map and check+count childStates.
+	// REO: No longer translation of LDtypeName (parset) and LDtypeValue (APL_Defines).
+	//      Only strings are used now.
+	for(TString2LDStateMap::iterator statesIt = m_childStates.begin();statesIt != m_childStates.end();++statesIt) {
+		if(statesIt->first == type || type == LDTYPE_NO_TYPE) {
+			totalLDs += 1.0;
+			LOG_DEBUG(formatString("%s is in state %s",statesIt->first.c_str(),_state2String(statesIt->second).c_str()));
+			if(statesIt->second == state) {
+				ldsInState += 1.0;
+			}
+		}
+	}
+
+	// Calculate %.
+	double resultingPercentage(0.0);
+	if(totalLDs > 0.0) {
+		resultingPercentage = ldsInState/totalLDs*100.0;
+	}
+
+	return (resultingPercentage >= requiredPercentage);
 }
 
 //
@@ -899,32 +928,31 @@ bool LogicalDevice::_childsInState(const double requiredPercentage, const TLogic
 //
 // Check if enough LD's of a specific type are not in a specific state
 //
-bool LogicalDevice::_childsNotInState(const double requiredPercentage, const TLogicalDeviceTypes& type, const TLogicalDeviceState& state)
+bool LogicalDevice::_childsNotInState(const double requiredPercentage, const string& type, const TLogicalDeviceState& state)
 {
-  double totalLDs(0.0);
-  double ldsNotInState(0.0);
-  
-  // Loop over childTypes map and check+count childStates.
-  for(TString2LDTypeMap::iterator typesIt = m_childTypes.begin();typesIt != m_childTypes.end();++typesIt) {
-    if(typesIt->second == type || type == LDTYPE_NO_TYPE) {
-      totalLDs += 1.0;
-      TString2LDStateMap::iterator statesIt = m_childStates.find(typesIt->first);
-      if(statesIt != m_childStates.end()) {
-        LOG_DEBUG(formatString("%s is in state %s",typesIt->first.c_str(),_state2String(statesIt->second).c_str()));
-        if(statesIt->second != state) {
-          ldsNotInState += 1.0;
-        }
-      }
-    }
-  }
-  
-  // Calculate %.
-  double resultingPercentage(0.0);
-  if(totalLDs > 0.0) {
-    resultingPercentage = ldsNotInState/totalLDs*100.0;
-  }
-  
-  return (resultingPercentage >= requiredPercentage);
+	double totalLDs(0.0);
+	double ldsNotInState(0.0);
+
+	// Loop over childTypes map and check+count childStates.
+	// REO: No longer translation of LDtypeName (parset) and LDtypeValue (APL_Defines).
+	//      Only strings are used now.
+	for(TString2LDStateMap::iterator statesIt = m_childStates.begin();statesIt != m_childStates.end();++statesIt) {
+		if(statesIt->first == type || type == LDTYPE_NO_TYPE) {
+			totalLDs += 1.0;
+			LOG_DEBUG(formatString("%s is in state %s",statesIt->first.c_str(),_state2String(statesIt->second).c_str()));
+			if(statesIt->second != state) {
+				ldsNotInState += 1.0;
+			}
+		}
+	}
+
+	// Calculate %.
+	double resultingPercentage(0.0);
+	if(totalLDs > 0.0) {
+		resultingPercentage = ldsNotInState/totalLDs*100.0;
+	}
+
+	return (resultingPercentage >= requiredPercentage);
 }
 
 //
@@ -955,13 +983,13 @@ void LogicalDevice::_connectedHandler(GCFPortInterface& port)
 		// Note: Providing the child with a portnumber is not realy necc. (ServiceBroker) [REO]
         string key = (*chIt) + string(".parentPort");
         KVpair kvPair(key,serverPort);
-        m_parameterSet.replace(kvPair);
+        m_parameterSet->replace(kvPair);
       
 		// get the specs from the startDaemon of this child ...
-        string remoteSystemName    = m_parameterSet.getString((*chIt) + string(".remoteSystem"));
-        string startDaemonHostName = m_parameterSet.getString((*chIt) + string(".startDaemonHost"));
-        uint16 startDaemonPortNr   = m_parameterSet.getUint16((*chIt) + string(".startDaemonPort"));
-        string startDaemonTaskName = m_parameterSet.getString((*chIt) + string(".startDaemonTask"));
+        string remoteSystemName    = m_parameterSet->getString((*chIt) + string(".remoteSystem"));
+        string startDaemonHostName = m_parameterSet->getString((*chIt) + string(".startDaemonHost"));
+        uint16 startDaemonPortNr   = m_parameterSet->getUint16((*chIt) + string(".startDaemonPort"));
+        string startDaemonTaskName = m_parameterSet->getString((*chIt) + string(".startDaemonTask"));
       
         TPortSharedPtr startDaemonPort(new TRemotePort(*this,startDaemonTaskName,GCFPortInterface::SAP,0));
 		// and open a connection to this startDaemon. In this way we are able the send 'create child'
@@ -979,7 +1007,7 @@ void LogicalDevice::_connectedHandler(GCFPortInterface& port)
           GCFPValueArray refsVector(childRefs->getValue()); // create a copy 
 		  // construct:  <hostname_child>:<psBaseName value>  --> e.g. CCU1:VIC_VI3
           string 		 childPsName = remoteSystemName + string(":") + 
-								m_parameterSet.getString((*chIt) + string(".propertysetBaseName"));
+								m_parameterSet->getString((*chIt) + string(".propertysetBaseName"));
 		  // construct:  <childname>=<childPsName>  --> e.g.  VI3=CCU1:VIC_VI3
           GCFPVString    newRef((*chIt) + string("=") + childPsName);
           refsVector.push_back(&newRef);						// add KVpair to child-vector
@@ -1187,11 +1215,11 @@ void LogicalDevice::_handleTimers(GCFEvent& event, GCFPortInterface& port)
     if(m_eventBuffer.size() > 0) {
       m_retrySendTimerId = 0;
       int32 retryTimeout = 1*60*60; // retry sending buffered events for 1 hour
-      // [REO] NOTE: GCF::ParameterSet is used here!!!!
-      GCF::ParameterSet* pParamSet = GCF::ParameterSet::instance();
+      // [REO] NOTE: GlobalParameterSet is used here!!!!
+      ACC::APS::ParameterSet* pParamSet = ACC::APS::globalParameterSet();
       try {
-        retryTimeout = pParamSet->getInt(string(LD_CONFIG_PREFIX + string("retryTimeout")));
-        retryPeriod  = pParamSet->getInt(LD_CONFIG_PREFIX + string("retryPeriod"));
+        retryTimeout = pParamSet->getInt32(string(LD_CONFIG_PREFIX + string("retryTimeout")));
+        retryPeriod  = pParamSet->getInt32(LD_CONFIG_PREFIX + string("retryPeriod"));
       } 
       catch(Exception& e) {
         LOG_INFO("Using default retry period of 10s");
@@ -1241,11 +1269,11 @@ void LogicalDevice::_handleTimers(GCFEvent& event, GCFPortInterface& port)
 void LogicalDevice::_connectParent()
 {
   // connect to the parent if it is a new parent
-  string parentTaskName = m_parameterSet.getString("parentTask");
+  string parentTaskName = m_parameterSet->getString("parentTask");
   
   if(m_parentPorts.find(parentTaskName) == m_parentPorts.end()) {  
-    string parentHost     = m_parameterSet.getString("parentHost");//TiMu
-    uint16 parentPort     = m_parameterSet.getUint16("parentPort");//TiMu
+    string parentHost     = m_parameterSet->getString("parentHost");//TiMu
+    uint16 parentPort     = m_parameterSet->getUint16("parentPort");//TiMu
     
     // it is possible that parents do not yet exist while constructing this LD
     // (e.g. SO starts when a station starts, even if there are no CCU's)
@@ -1279,7 +1307,7 @@ vector<string> LogicalDevice::_getChildKeys()
   string childs;
   vector<string> childKeys;
   try {
-    childKeys = m_parameterSet.getStringVector("childs");
+    childKeys = m_parameterSet->getStringVector("childs");
   }
   catch(Exception& e) {
   }
@@ -1320,7 +1348,7 @@ void LogicalDevice::_sendScheduleToClients()
         // extract the parameterset for the child
         string startDaemonKey = it->first;
         TPortSharedPtr startDaemonPort = it->second;
-        ACC::APS::ParameterSet psSubset = m_parameterSet.makeSubset(startDaemonKey + string("."));
+        ParameterSet psSubset = m_parameterSet->makeSubset(startDaemonKey + string("."));
         
         concreteAddExtraKeys(psSubset);
         
@@ -1333,15 +1361,15 @@ void LogicalDevice::_sendScheduleToClients()
         remove(tempFileName.c_str());
   
         // send the schedule to the startdaemon of the child
-        string ldTypeString = psSubset.getString("logicalDeviceType");
-        TLogicalDeviceTypes ldType = APLUtilities::convertLogicalDeviceType(ldTypeString);
-        boost::shared_ptr<STARTDAEMONScheduleEvent> scheduleEvent(new STARTDAEMONScheduleEvent);
-        scheduleEvent->logicalDeviceType = ldType;
-	//        scheduleEvent->taskName = getName() + string(".") + startDaemonKey;
-        scheduleEvent->taskName = startDaemonKey;
-        scheduleEvent->fileName = parameterFileName;
-
-        _sendEvent(scheduleEvent,*startDaemonPort);
+        string ldType = psSubset.getString("logicalDeviceType");
+        boost::shared_ptr<STARTDAEMONCreateEvent> createEvent(new STARTDAEMONCreateEvent);
+        createEvent->logicalDeviceType = ldType;
+//      createEvent->fileName = parameterFileName;
+        createEvent->taskName 	   = startDaemonKey;
+        createEvent->parentHost    = GCF::Common::myHostname();
+        createEvent->parentService = "TODO";
+
+        _sendEvent(createEvent,*startDaemonPort);
       }
       catch(Exception& e) {
         LOG_FATAL(formatString("(%s) Fatal error while scheduling child",e.message().c_str()));
@@ -1357,7 +1385,7 @@ void LogicalDevice::_sendScheduleToClients()
         // extract the parameterset for the child
         string childKey = it->first;
         if(TPortSharedPtr pChildPort = it->second.lock()) {
-          ACC::APS::ParameterSet psSubset = m_parameterSet.makeSubset(childKey + string("."));
+          ParameterSet psSubset = m_parameterSet->makeSubset(childKey + string("."));
           
           concreteAddExtraKeys(psSubset);
           
@@ -1392,8 +1420,8 @@ void LogicalDevice::_sendScheduleToClients()
 string LogicalDevice::_getShareLocation() const
 {
   string shareLocation("/opt/lofar/MAC/parametersets/");
-  // [REO] NOTE: GCF::ParameterSet is used here!!!!
-  GCF::ParameterSet* pParamSet = GCF::ParameterSet::instance();
+  // [REO] NOTE: GlobalParameterSet is used here!!!!
+  ACC::APS::ParameterSet* pParamSet = ACC::APS::globalParameterSet();
   try {
     string tempShareLocation = pParamSet->getString(LD_CONFIG_PREFIX + string("shareLocation"));
     if(tempShareLocation.length()>0) {
@@ -1531,10 +1559,10 @@ GCFEvent::TResult LogicalDevice::initial_state(GCFEvent& event, GCFPortInterface
 
         // poll retry buffer every 10 seconds
         int32 retryPeriod = 10; // retry sending buffered events every 10 seconds
-        // [REO] NOTE: GCF::ParameterSet is used here!!!!
-        GCF::ParameterSet* pParamSet = GCF::ParameterSet::instance();
+        // [REO] NOTE: GlobalParameterSet is used here!!!!
+        ACC::APS::ParameterSet* pParamSet = ACC::APS::globalParameterSet();
         try {
-          retryPeriod  = pParamSet->getInt(LD_CONFIG_PREFIX + string("retryPeriod"));
+          retryPeriod  = pParamSet->getInt32(LD_CONFIG_PREFIX + string("retryPeriod"));
         }
         catch(Exception& e) {
           LOG_INFO("Using default retry period of 10s");
@@ -1693,7 +1721,7 @@ GCFEvent::TResult LogicalDevice::idle_state(GCFEvent& event, GCFPortInterface& p
     case LOGICALDEVICE_SCHEDULE: {
       LOGICALDEVICEScheduleEvent scheduleEvent(event);
 
-      m_parameterSet.adoptFile(_getShareLocation() + scheduleEvent.fileName);
+      m_parameterSet->adoptFile(_getShareLocation() + scheduleEvent.fileName);
       _schedule();		// distribute claim/prepare/start/stop time to children.
       // if the claimTime = 0 then claiming is done ASAP
       if(m_claimTime == 0) {
@@ -1925,7 +1953,7 @@ GCFEvent::TResult LogicalDevice::claimed_state(GCFEvent& event, GCFPortInterface
     case LOGICALDEVICE_SCHEDULE: {
       LOGICALDEVICEScheduleEvent scheduleEvent(event);
 
-      m_parameterSet.adoptFile(_getShareLocation() + scheduleEvent.fileName);
+      m_parameterSet->adoptFile(_getShareLocation() + scheduleEvent.fileName);
       _schedule();		// distribute claim/prepare/start/stop time to children.
       
       boost::shared_ptr<LOGICALDEVICEScheduledEvent> scheduledEvent(new LOGICALDEVICEScheduledEvent);
@@ -2427,10 +2455,16 @@ GCFEvent::TResult LogicalDevice::goingdown_state(GCFEvent& event, GCFPortInterfa
       m_basePropertySet->setValue(LD_PROPNAME_STATE,state);
       LOG_INFO(formatString("%s - enter state %s",getName().c_str(),_state2String(getLogicalDeviceState()).c_str()));
 
-      // the startdaemon has created us, so the startdaemon should destroy us.
-      STARTDAEMONDestroyLogicaldeviceEvent destroyEvent;
-      destroyEvent.name = getName();
-      m_startDaemon->dispatch(destroyEvent,port);
+      // if the startdaemon has created us, the startdaemon should destroy us.
+//	  if (m_startDaemon) {
+//		STARTDAEMONDestroyLogicaldeviceEvent destroyEvent;
+//		destroyEvent.name = getName();
+//		m_startDaemon->dispatch(destroyEvent,port);
+//	  }
+//	  else {
+		LOG_DEBUG ("Not created by startdaemon, killing myself");
+		stop();
+//	  }
       break;
     }
   
diff --git a/MAC/APL/APLCommon/src/LogicalDevice_Protocol.prot b/MAC/APL/APLCommon/src/LogicalDevice_Protocol.prot
index c60fb8e604545c92fc5246a5e82dee77d0ea4b8c..9c1d54b13c43b6fe0b5f34898b6fe267a47ea6bd 100644
--- a/MAC/APL/APLCommon/src/LogicalDevice_Protocol.prot
+++ b/MAC/APL/APLCommon/src/LogicalDevice_Protocol.prot
@@ -213,3 +213,36 @@ event = {
     type = "APLCommon::TLDResult";
   };
 };
+
+//
+// FINISH - sent by a child to tell its parent it is dying.
+//
+event = {
+  signal = FINISH;
+  dir = IN; // from child to parent
+  param = {
+    name = "treeID";
+    type = "unsigned int";
+  };
+  param = {
+    name = "succesfull";
+    type = "bool";
+  };
+  param = {
+    name = "errorMsg";
+    type = "string";
+  };
+};
+
+//
+// FINISHED - result of the FINISH request
+//
+event = {
+  signal = FINISHED;
+  dir = OUT; // from parent to child
+  param = {
+    name = "result";
+    type = "APLCommon::TLDResult";
+  };
+};
+
diff --git a/MAC/APL/APLCommon/src/Makefile.am b/MAC/APL/APLCommon/src/Makefile.am
index 43cad1b9b26b8461760bba79080a92e2768619a1..5d509cd64467be3aaaa2df64bc59135883847007 100644
--- a/MAC/APL/APLCommon/src/Makefile.am
+++ b/MAC/APL/APLCommon/src/Makefile.am
@@ -16,7 +16,6 @@ libaplcommon_la_SOURCES = \
 	$(DOCHDRS) \
 	APLUtilities.cc \
 	LogicalDevice.cc \
-	StartDaemon.cc \
 	PropertySetAnswer.cc \
 	ResourceAllocator.cc \
 	LogicalDevice_Protocol.cc \
diff --git a/MAC/APL/APLCommon/src/PropertySetAnswer.cc b/MAC/APL/APLCommon/src/PropertySetAnswer.cc
index d0ee446cb669810a348c1005ebb01806f2127010..7db7539c1ff1d876970dab072b1173fc411013df 100644
--- a/MAC/APL/APLCommon/src/PropertySetAnswer.cc
+++ b/MAC/APL/APLCommon/src/PropertySetAnswer.cc
@@ -33,8 +33,6 @@ using namespace LOFAR::GCF::TM;
 using namespace LOFAR::GCF::PAL;
 using namespace LOFAR::APLCommon;
 
-INIT_TRACER_CONTEXT(PropertySetAnswer,LOFARLOGGER_PACKAGE);
-
 PropertySetAnswer::PropertySetAnswer(PropertySetAnswerHandlerInterface& handler) :
   GCFAnswer(),
   m_handler(handler)
diff --git a/MAC/APL/APLCommon/src/ResourceAllocator.cc b/MAC/APL/APLCommon/src/ResourceAllocator.cc
index 4cdd0e9201ad93b203819a25346559e6c9d87101..db45f7eb90660c2c81613acb55f917641261e141 100644
--- a/MAC/APL/APLCommon/src/ResourceAllocator.cc
+++ b/MAC/APL/APLCommon/src/ResourceAllocator.cc
@@ -71,26 +71,21 @@ bool ResourceAllocator::claimSO(ResourceAllocator::LogicalDevicePtr ld, uint16 p
   bool allocated=false;
   TSOAllocation allocationRequest(ld, priority, samplingFrequency);
   
-  if(m_allocatedSOSet.size() == 0)
-  {
+  if(m_allocatedSOSet.size() == 0) {
     m_allocatedSOSet.insert(allocationRequest);
     allocated=true;
   }
-  else
-  {
+  else {
     // check required parameters against current parameters
     TSOAllocationSet::iterator currentAllocation = m_allocatedSOSet.begin();
-    if(_matchSOparameters(*currentAllocation, allocationRequest))
-    {
+    if(_matchSOparameters(*currentAllocation, allocationRequest)) {
       // required parameters match. Add the LD to the allocation
       m_allocatedSOSet.insert(allocationRequest);
       allocated=true;
     }
-    else
-    {
+    else {
       // required parameters do not match. Check priority and suspend the lower priority LD's
-      if(priority < currentAllocation->priority)
-      {
+      if(priority < currentAllocation->priority) {
         m_allocatedSOSet.insert(allocationRequest);
         allocated=true;
         
@@ -99,24 +94,18 @@ bool ResourceAllocator::claimSO(ResourceAllocator::LogicalDevicePtr ld, uint16 p
         //    resume lower priority LD's with the same settings
         TSOAllocationSet::iterator it = m_allocatedSOSet.begin();
         ++it; // the first item was just added and has the highest priority.
-        while(it != m_allocatedSOSet.end())
-        {
-          if(_matchSOparameters(allocationRequest, *it)) // *it is now the requested allocation, 
-          {                                              // because the other one has a higher priority
+        while(it != m_allocatedSOSet.end()) {
+          if(_matchSOparameters(allocationRequest, *it)) { // *it is now the requested allocation, 
+                                                           // because the other one has a higher priority
+            LOG_INFO(formatString("Resuming LogicalDevice %s",it->ld->getName().c_str()));
 #ifndef TESTBUILD
-            LOG_INFO(formatString("Resuming LogicalDevice %s",it->ld->getName().c_str()))
             it->ld->resume();
-#else
-            LOG_INFO(formatString("Resuming LogicalDevice"))
 #endif
           }
-          else
-          {
+          else {
+            LOG_INFO(formatString("Suspending LogicalDevice %s",it->ld->getName().c_str()));
 #ifndef TESTBUILD
-            LOG_INFO(formatString("Suspending LogicalDevice %s",it->ld->getName().c_str()))
             it->ld->suspend(LD_RESULT_LOW_PRIORITY);
-#else
-            LOG_INFO(formatString("Suspending LogicalDevice"))
 #endif
           }
           ++it;
@@ -124,8 +113,8 @@ bool ResourceAllocator::claimSO(ResourceAllocator::LogicalDevicePtr ld, uint16 p
       }
     } 
   }
-  LOG_INFO(formatString("Resource claim %sgranted",(allocated?"":"NOT ")))
-  LOG_INFO(formatString("%d SO's allocated",m_allocatedSOSet.size()))
+  LOG_INFO(formatString("Resource claim %sgranted",(allocated?"":"NOT ")));
+  LOG_INFO(formatString("%d SO's allocated",m_allocatedSOSet.size()));
   return allocated;
 }
 
@@ -136,34 +125,29 @@ void ResourceAllocator::releaseSO(ResourceAllocator::LogicalDevicePtr ld)
   // remove the LD from the queue
   bool found(false);
   TSOAllocationSet::iterator it = m_allocatedSOSet.begin();
-  while(!found && it != m_allocatedSOSet.end())
-  {
-    if(it->ld == ld)
-    {
+  while(!found && it != m_allocatedSOSet.end()) {
+    if(it->ld == ld) {
       m_allocatedSOSet.erase(it);
       found = true;
     }
-    else
+    else {
       ++it;
+	}
   }
   
   // resume all LD's with the same samplingfrequency as the highest priority one
   TSOAllocationSet::iterator currentAllocation = m_allocatedSOSet.begin();
   it = m_allocatedSOSet.begin();
-  while(it != m_allocatedSOSet.end())
-  {
-    if(_matchSOparameters(*currentAllocation, *it))
-    {
+  while(it != m_allocatedSOSet.end()) {
+    if(_matchSOparameters(*currentAllocation, *it)) {
+      LOG_INFO(formatString("Resuming LogicalDevice %s",it->ld->getName().c_str()));
 #ifndef TESTBUILD
-      LOG_INFO(formatString("Resuming LogicalDevice %s",it->ld->getName().c_str()))
       it->ld->resume();
-#else
-      LOG_INFO(formatString("Resuming LogicalDevice"))
 #endif
     }
     ++it;
   }
-  LOG_INFO(formatString("%d SO's allocated",m_allocatedSOSet.size()))
+  LOG_INFO(formatString("%d SO's allocated",m_allocatedSOSet.size()));
 }
 
 void ResourceAllocator::logSOallocation() const
@@ -171,8 +155,7 @@ void ResourceAllocator::logSOallocation() const
   stringstream logStream;
   logStream << "SO allocation log" << endl;
   logStream << "LD name, priority, sampling frequency" << endl;
-  for(TSOAllocationSet::iterator it = m_allocatedSOSet.begin(); it != m_allocatedSOSet.end(); ++it)
-  {
+  for(TSOAllocationSet::iterator it = m_allocatedSOSet.begin(); it != m_allocatedSOSet.end(); ++it) {
 #ifndef TESTBUILD
     logStream << it->ld->getName().c_str() << ", ";
 #endif
@@ -195,27 +178,22 @@ bool ResourceAllocator::claimSRG(ResourceAllocator::LogicalDevicePtr ld, uint16
   bool allocated=false;
   TSRGAllocation allocationRequest(ld, priority, rcuSubset, nyquistZone, rcuControl);
   
-  if(m_allocatedSRGSet.size() == 0)
-  {
+  if(m_allocatedSRGSet.size() == 0) {
     m_allocatedSRGSet.insert(allocationRequest);
     _addSRGallocation(rcuSubset,nyquistZone,rcuControl);
     allocated=true;
   }
-  else
-  {
+  else {
     // check required parameters against current parameters
-    if(_matchSRGparameters(allocationRequest))
-    {
+    if(_matchSRGparameters(allocationRequest)) {
       // required parameters match. Add the LD to the allocation
       m_allocatedSRGSet.insert(allocationRequest);
       _addSRGallocation(rcuSubset,nyquistZone,rcuControl);
       allocated=true;
     }
-    else
-    {
+    else {
       // required parameters do not match. Check priority and suspend the lower priority LD's
-      if(priority < m_allocatedSRGSet.begin()->priority)
-      {
+      if(priority < m_allocatedSRGSet.begin()->priority) {
         m_allocatedSRGSet.insert(allocationRequest);
         m_allocatedSRGRcuSubset = 0;  // rebuild 
         m_allocatedSRGRcuSettingsMap.clear();
@@ -226,25 +204,18 @@ bool ResourceAllocator::claimSRG(ResourceAllocator::LogicalDevicePtr ld, uint16
         //    resume lower priority LD's with the same settings
         TSRGAllocationSet::iterator it = m_allocatedSRGSet.begin();
         ++it; // the first item was just added and has the highest priority.
-        while(it != m_allocatedSRGSet.end())
-        {
-          if(_matchSRGparameters(*it))
-          {
+        while(it != m_allocatedSRGSet.end()) {
+          if(_matchSRGparameters(*it)) {
+            LOG_INFO(formatString("Resuming LogicalDevice %s",it->ld->getName().c_str()));
 #ifndef TESTBUILD
-            LOG_INFO(formatString("Resuming LogicalDevice %s",it->ld->getName().c_str()))
             it->ld->resume();
-#else
-            LOG_INFO(formatString("Resuming LogicalDevice"))
 #endif
             _addSRGallocation(rcuSubset, nyquistZone, rcuControl);
           }
-          else
-          {
+          else {
+            LOG_INFO(formatString("Suspending LogicalDevice %s",it->ld->getName().c_str()));
 #ifndef TESTBUILD
-            LOG_INFO(formatString("Suspending LogicalDevice %s",it->ld->getName().c_str()))
             it->ld->suspend(LD_RESULT_LOW_PRIORITY);
-#else
-            LOG_INFO(formatString("Suspending LogicalDevice"))
 #endif
           }
           ++it;
@@ -252,8 +223,8 @@ bool ResourceAllocator::claimSRG(ResourceAllocator::LogicalDevicePtr ld, uint16
       }
     } 
   }
-  LOG_INFO(formatString("Resource claim %sgranted",(allocated?"":"NOT ")))
-  LOG_INFO(formatString("%d SRG's allocated",m_allocatedSRGSet.size()))
+  LOG_INFO(formatString("Resource claim %sgranted",(allocated?"":"NOT ")));
+  LOG_INFO(formatString("%d SRG's allocated",m_allocatedSRGSet.size()));
   return allocated;
 }
 
@@ -264,36 +235,31 @@ void ResourceAllocator::releaseSRG(ResourceAllocator::LogicalDevicePtr ld)
   // remove the LD from the queue
   bool found(false);
   TSRGAllocationSet::iterator it = m_allocatedSRGSet.begin();
-  while(!found && it != m_allocatedSRGSet.end())
-  {
-    if(it->ld == ld)
-    {
+  while(!found && it != m_allocatedSRGSet.end()) {
+    if(it->ld == ld) {
       m_allocatedSRGSet.erase(it);
       found = true;
     }
-    else
+    else {
       ++it;
+	}
   }
   
   // resume all LD's with non-overlapping parameters with the highest priority one
   m_allocatedSRGRcuSubset = 0;
   m_allocatedSRGRcuSettingsMap.clear();
   it = m_allocatedSRGSet.begin();
-  while(it != m_allocatedSRGSet.end())
-  {
-    if(_matchSRGparameters(*it))
-    {
+  while(it != m_allocatedSRGSet.end()) {
+    if(_matchSRGparameters(*it)) {
+      LOG_INFO(formatString("Resuming LogicalDevice %s",it->ld->getName().c_str()));
 #ifndef TESTBUILD
-      LOG_INFO(formatString("Resuming LogicalDevice %s",it->ld->getName().c_str()))
       it->ld->resume();
-#else
-      LOG_INFO(formatString("Resuming LogicalDevice"))
 #endif
       _addSRGallocation(it->rcuSubset, it->nyquistZone, it->rcuControl);
     }
     ++it;
   }
-  LOG_INFO(formatString("%d SRG's allocated",m_allocatedSRGSet.size()))
+  LOG_INFO(formatString("%d SRG's allocated",m_allocatedSRGSet.size()));
 }
 
 void ResourceAllocator::logSRGallocation() const
@@ -301,8 +267,7 @@ void ResourceAllocator::logSRGallocation() const
   stringstream logStream;
   logStream << "SRG allocation log" << endl;
   logStream << "LD name, priority, nyquistZone, rcuControl, rcu subset" << endl;
-  for(TSRGAllocationSet::iterator it = m_allocatedSRGSet.begin(); it != m_allocatedSRGSet.end(); ++it)
-  {
+  for(TSRGAllocationSet::iterator it = m_allocatedSRGSet.begin(); it != m_allocatedSRGSet.end(); ++it) {
 #ifndef TESTBUILD
     logStream << it->ld->getName().c_str() << ", ";
 #endif
@@ -317,18 +282,14 @@ void ResourceAllocator::logSRGallocation() const
 bool ResourceAllocator::_matchSRGparameters(const TSRGAllocation& requested)
 {
   bool match = true;
-  if((requested.rcuSubset & m_allocatedSRGRcuSubset) != 0)
-  {
+  if((requested.rcuSubset & m_allocatedSRGRcuSubset) != 0) {
     // overlapping rcu usage. Check settings
-    for(size_t i=0;match && i < requested.rcuSubset.size();i++)
-    {
+    for(size_t i=0;match && i < requested.rcuSubset.size();i++) {
       // check overlap
-      if(requested.rcuSubset.test(i) && m_allocatedSRGRcuSubset.test(i))
-      {
+      if(requested.rcuSubset.test(i) && m_allocatedSRGRcuSubset.test(i)) {
         // check settings
         if(m_allocatedSRGRcuSettingsMap[i].nyquistZone != requested.nyquistZone ||
-           m_allocatedSRGRcuSettingsMap[i].rcuControl  != requested.rcuControl)
-        {
+           m_allocatedSRGRcuSettingsMap[i].rcuControl  != requested.rcuControl) {
           match = false;
         }
       }
@@ -340,10 +301,8 @@ bool ResourceAllocator::_matchSRGparameters(const TSRGAllocation& requested)
 void ResourceAllocator::_addSRGallocation(TRcuSubset rcuSubset, int16 nyquistZone, uint8 rcuControl)
 {
   m_allocatedSRGRcuSubset |= rcuSubset;
-  for(size_t i=0;i < rcuSubset.size();i++)
-  {
-    if(rcuSubset.test(i))
-    {
+  for(size_t i=0;i < rcuSubset.size();i++) {
+    if(rcuSubset.test(i)) {
       m_allocatedSRGRcuSettingsMap[i] = TRcuSettings(nyquistZone,rcuControl);
     }
   }
diff --git a/MAC/APL/APLCommon/src/StartDaemon.cc b/MAC/APL/APLCommon/src/StartDaemon.cc
deleted file mode 100644
index e74c9d03a5ceb7302f1c138707504f18666c4dbe..0000000000000000000000000000000000000000
--- a/MAC/APL/APLCommon/src/StartDaemon.cc
+++ /dev/null
@@ -1,461 +0,0 @@
-//#  StartDaemon.cc: Base class for logical device factories.
-//#
-//#  Copyright (C) 2002-2004
-//#  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$
-#undef PACKAGE
-#undef VERSION
-#include <lofar_config.h>
-#include <Common/LofarLogger.h>
-
-#include <GCF/GCF_PVInteger.h>
-#include <GCF/PAL/GCF_PVSSInfo.h>
-#include "APL/APLCommon/APL_Defines.h"
-#include "APL/APLCommon/APLUtilities.h"
-#include "APL/APLCommon/LogicalDevice.h"
-#include "APL/APLCommon/LogicalDeviceFactoryBase.h"
-
-#include "APL/APLCommon/StartDaemon.h"
-#include "StartDaemon_Protocol.ph"
-
-using namespace LOFAR::GCF::Common;
-using namespace LOFAR::GCF::TM;
-using namespace LOFAR::GCF::PAL;
-
-namespace LOFAR
-{
-namespace APLCommon
-{
-
-const string StartDaemon::PSTYPE_STARTDAEMON("TAplStartDaemon");
-const string StartDaemon::SD_PROPNAME_COMMAND("command");
-const string StartDaemon::SD_PROPNAME_STATUS("status");
-const string StartDaemon::SD_COMMAND_SCHEDULE("SCHEDULE");
-const string StartDaemon::SD_COMMAND_DESTROY_LOGICALDEVICE("DESTROY_LOGICALDEVICE");
-const string StartDaemon::SD_COMMAND_STOP("STOP");
-
-INIT_TRACER_CONTEXT(StartDaemon,LOFARLOGGER_PACKAGE);
-
-// The pvss System Name is necessary to distinguish between startdaemon servers on different systems
-StartDaemon::StartDaemon(const string& name) :
-  GCFTask((State)&StartDaemon::initial_state,name),
-  PropertySetAnswerHandlerInterface(),
-  m_propertySetAnswer(*this),
-  m_properties(name.c_str(),PSTYPE_STARTDAEMON.c_str(),PS_CAT_TEMPORARY,&m_propertySetAnswer),
-  m_serverPortName(string("server")),
-  m_serverPort(),
-  m_childPorts(),
-  m_factories(),
-  m_logicalDevices(),
-  m_garbageCollection(),
-  m_garbageCollectionTimerId(0)
-{
-#ifndef USE_PVSSPORT
-  LOG_WARN("Using GCFTCPPort in stead of GCFPVSSPort");
-#endif
-
-  // PVSS must have been initialized before the local system name can be retrieved
-  string taskName = GCFPVSSInfo::getLocalSystemName()+string("_")+name;
-  setName(taskName);
-  // it is important to init the m_serverPort AFTER setting the name of the task.
-  m_serverPort.init(*this, m_serverPortName, GCFPortInterface::MSPP, STARTDAEMON_PROTOCOL),
-  
-
-  registerProtocol(STARTDAEMON_PROTOCOL, STARTDAEMON_PROTOCOL_signalnames);
-  LOG_DEBUG(formatString("StartDaemon(%s)::StartDaemon",getName().c_str()));
-  
-  m_properties.enable();
-}
-
-
-StartDaemon::~StartDaemon()
-{
-  LOG_DEBUG(formatString("StartDaemon(%s)::~StartDaemon",getName().c_str()));
-  m_properties.disable();
-}
-
-void StartDaemon::registerFactory(TLogicalDeviceTypes ldType,boost::shared_ptr<LogicalDeviceFactoryBase> factory)
-{
-  m_factories[ldType] = factory;
-}
-
-TSDResult StartDaemon::createLogicalDevice(const TLogicalDeviceTypes ldType, const string& taskName, const string& fileName)
-{
-  TSDResult result = SD_RESULT_NO_ERROR;
-  TFactoryMap::iterator itFactories = m_factories.find(ldType);
-  if(m_factories.end() != itFactories)
-  {
-    TLogicalDeviceMap::iterator itDevices = m_logicalDevices.find(taskName);
-    if(itDevices == m_logicalDevices.end())
-    {
-      try
-      {
-	boost::shared_ptr<LogicalDevice> ld = itFactories->second->createLogicalDevice(taskName,fileName,this);
-        m_logicalDevices[taskName] = ld;
-        ld->start(); // make initial transition
-      }
-      catch(APLCommon::ParameterFileNotFoundException& e)
-      {
-        LOG_FATAL(e.message());
-        result = SD_RESULT_FILENOTFOUND;
-      }
-      catch(APLCommon::ParameterNotFoundException& e)
-      {
-        LOG_FATAL(e.message());
-        result = SD_RESULT_PARAMETERNOTFOUND;
-      }
-      catch(APLCommon::WrongVersionException& e)
-      {
-        LOG_FATAL(e.message());
-        result = SD_RESULT_WRONG_VERSION;
-      }
-      catch(Exception& e)
-      {
-        LOG_FATAL(e.message());
-        result = SD_RESULT_UNSPECIFIED_ERROR;
-      }
-    }
-    else
-    {
-      if(itFactories->second->sharingAllowed())
-      {
-        LOG_INFO(formatString("LogicalDevice %s allows sharing. Updating parameters.",taskName.c_str()));
-	itFactories->second->createLogicalDevice(taskName,fileName,this);
-        // ignoring the returned pointer because the instance is already in the logicalDeviceMap
-      }
-      else
-      {
-        LOG_FATAL_STR("Requested Logical Device ("<<taskName<<") already exists and sharing is not allowed");
-        result = SD_RESULT_ALREADY_EXISTS;
-      }
-    }
-  }
-  else
-  {
-    LOG_FATAL_STR("Requested Logical Device ("<<ldType<<") cannot be created by this StartDaemon");
-    result = SD_RESULT_UNSUPPORTED_LD;
-  }
-  return result;
-}
-
-TSDResult StartDaemon::destroyLogicalDevice(const string& name)
-{
-  TSDResult result = SD_RESULT_NO_ERROR;
-  TLogicalDeviceMap::iterator it = m_logicalDevices.find(name);
-  if(it == m_logicalDevices.end())
-  {
-    result = SD_RESULT_LD_NOT_FOUND;
-  }
-  else
-  {
-    if(it->second->getLogicalDeviceState() == LogicalDevice::LOGICALDEVICE_STATE_GOINGDOWN)
-    {
-      LOG_DEBUG(formatString("Adding '%s' to the collection of garbage",name.c_str()));
-      // add the LD to the collection of garbage.
-      m_garbageCollection[it->first] = it->second;
-      m_garbageCollectionTimerId = m_serverPort.setTimer(0L,1000L); // 1000 microseconds
-      
-      // erase the LD from the collection of LD's.
-      m_logicalDevices.erase(it);
-    }
-    else
-    {
-      result = SD_RESULT_WRONG_STATE;
-    }
-  }
-  return result;
-}
-
-bool StartDaemon::_isServerPort(GCFPortInterface& port)
-{
-  return (&port == &m_serverPort); // comparing two pointers. yuck?
-}
-   
-bool StartDaemon::_isChildPort(GCFPortInterface& port)
-{
-  bool found=false;
-  TPortVector::iterator it=m_childPorts.begin();
-  while(!found && it != m_childPorts.end())
-  {
-    found = (&port == (*it).get()); // comparing two pointers. yuck?
-    ++it;
-  }
-  return found;
-}
-   
-void StartDaemon::_disconnectedHandler(GCFPortInterface& port)
-{
-  port.close();
-  if(_isServerPort(port))
-  {
-  }
-  else if(_isChildPort(port))
-  {
-    bool found=false;
-    TPortVector::iterator it=m_childPorts.begin();
-    while(!found && it != m_childPorts.end())
-    {
-      found = (&port == (*it).get()); // comparing two pointers. yuck?
-      if(found)
-      {
-        m_childPorts.erase(it);
-      }
-      else
-      { 
-        ++it;
-      }
-    }
-  }
-}
-
-GCFEvent::TResult StartDaemon::initial_state(GCFEvent& event, GCFPortInterface& port)
-{
-  LOG_DEBUG(formatString("StartDaemon(%s)::initial_state (%s)",getName().c_str(),evtstr(event)));
-  GCFEvent::TResult status = GCFEvent::HANDLED;
-  
-  switch (event.signal)
-  {
-    case F_INIT:
-      break;
-
-    case F_ENTRY:
-    {
-      TRAN(StartDaemon::idle_state);
-      break;
-    }
-  
-    case F_CONNECTED:
-      break;
-
-    case F_DISCONNECTED:
-      port.close();
-      break;
-    
-    default:
-      LOG_DEBUG(formatString("StartDaemon(%s)::initial_state, default",getName().c_str()));
-      status = GCFEvent::NOT_HANDLED;
-      break;
-  }    
-
-  return status;
-}
-
-GCFEvent::TResult StartDaemon::idle_state(GCFEvent& event, GCFPortInterface& port)
-{
-  LOG_DEBUG(formatString("StartDaemon(%s)::idle_state (%s)",getName().c_str(),evtstr(event)));
-  GCFEvent::TResult status = GCFEvent::HANDLED;
-
-  switch (event.signal)
-  {
-    case F_INIT:
-      break;
-      
-    case F_ENTRY:
-    {
-      // open the server port to allow childs to connect
-      m_serverPort.open();
-      break;
-    }
-
-    case F_ACCEPT_REQ:
-    {
-      boost::shared_ptr<TThePortTypeInUse> server(new TThePortTypeInUse);
-      server->init(*this, m_serverPortName, GCFPortInterface::SPP, STARTDAEMON_PROTOCOL);
-      m_serverPort.accept(*(server.get()));
-      m_childPorts.push_back(server);
-      break;
-    }
-  
-    case F_DISCONNECTED:
-      _disconnectedHandler(port);
-      break;
-      
-    case F_TIMER:
-    {
-      GCFTimerEvent& timerEvent=static_cast<GCFTimerEvent&>(event);
-      if(timerEvent.id == m_garbageCollectionTimerId)
-      {
-        LOG_DEBUG("Cleaning up the LogicalDevice garbage...");
-        // garbage collection
-        TLogicalDeviceMap::iterator it = m_garbageCollection.begin();
-        while(it != m_garbageCollection.end())
-        {
-          LOG_DEBUG(formatString("Destroying '%s'",it->first.c_str()));
-          m_garbageCollection.erase(it);
-          it = m_garbageCollection.begin();
-        }
-        port.cancelTimer(timerEvent.id);
-        m_garbageCollectionTimerId = 0;
-      }
-      break;
-    }
-    
-    case STARTDAEMON_SCHEDULE:
-    {
-      STARTDAEMONScheduleEvent scheduleEvent(event);
-      STARTDAEMONScheduledEvent scheduledEvent;
-      
-      scheduledEvent.result = createLogicalDevice(scheduleEvent.logicalDeviceType,scheduleEvent.taskName, scheduleEvent.fileName);
-      
-      scheduledEvent.VIrootID = scheduleEvent.taskName;
-      
-      m_properties.setValue(SD_PROPNAME_STATUS,GCFPVInteger(scheduledEvent.result));
-      port.send(scheduledEvent);
-      break;
-    }
-    
-    case STARTDAEMON_DESTROY_LOGICALDEVICE:
-    {
-      STARTDAEMONDestroyLogicaldeviceEvent destroyEvent(event);
-      STARTDAEMONDestroyLogicaldeviceEvent* pDestroyEvent = &destroyEvent;
-      if(destroyEvent.name.length() == 0)
-      {
-        // the destroy event was sent from within this application, so it has
-        // not been packed. A static cast will do just fine.
-        pDestroyEvent = static_cast<STARTDAEMONDestroyLogicaldeviceEvent*>(&event);
-      } 
-      
-      TSDResult result = SD_RESULT_UNSPECIFIED_ERROR;
-      if(pDestroyEvent != 0)
-      {
-        result = destroyLogicalDevice(pDestroyEvent->name);
-      }
-      m_properties.setValue(SD_PROPNAME_STATUS,GCFPVInteger(result));
-      break;
-    }
-    
-    case STARTDAEMON_STOP:
-    {
-      stop();
-      m_properties.setValue(SD_PROPNAME_STATUS,GCFPVInteger(SD_RESULT_SHUTDOWN));
-      break;
-    }
-    
-    default:
-      LOG_DEBUG(formatString("StartDaemon(%s)::idle_state, default",getName().c_str()));
-      status = GCFEvent::NOT_HANDLED;
-      break;
-  }
-
-  return status;
-}
-
-void StartDaemon::handlePropertySetAnswer(GCFEvent& answer)
-{
-  switch(answer.signal)
-  {
-    case F_MYPS_ENABLED:
-    {
-      GCFPropSetAnswerEvent* pPropAnswer=static_cast<GCFPropSetAnswerEvent*>(&answer);
-      if(pPropAnswer->result == GCF_NO_ERROR)
-      {
-        // property set loaded, now load apc?
-      }
-      else
-      {
-        LOG_ERROR(formatString("%s : PropertySet %s NOT ENABLED",getName().c_str(),pPropAnswer->pScope));
-      }
-      break;
-    }
-    
-    case F_PS_CONFIGURED:
-    {
-      GCFConfAnswerEvent* pConfAnswer=static_cast<GCFConfAnswerEvent*>(&answer);
-      if(pConfAnswer->result == GCF_NO_ERROR)
-      {
-        LOG_DEBUG(formatString("%s : apc %s Loaded",getName().c_str(),pConfAnswer->pApcName));
-        //apcLoaded();
-      }
-      else
-      {
-        LOG_ERROR(formatString("%s : apc %s NOT LOADED",getName().c_str(),pConfAnswer->pApcName));
-      }
-      break;
-    }
-    
-    case F_VCHANGEMSG:
-    {
-      // check which property changed
-      GCFPropValueEvent* pPropAnswer=static_cast<GCFPropValueEvent*>(&answer);
-      if ((pPropAnswer->pValue->getType() == LPT_STRING) &&
-          (strstr(pPropAnswer->pPropName, SD_PROPNAME_COMMAND.c_str()) != 0))
-      {
-        // command received
-        string commandString(((GCFPVString*)pPropAnswer->pValue)->getValue());
-        vector<string> parameters;
-        string command;
-        APLUtilities::decodeCommand(commandString,command,parameters);
-        
-        // SCHEDULE <type>,<taskname>,<filename>
-        if(command==string(SD_COMMAND_SCHEDULE))
-        {
-          if(parameters.size()==3)
-          {
-            TLogicalDeviceTypes logicalDeviceType = APLUtilities::convertLogicalDeviceType(parameters[0]);
-            string taskName = parameters[1];
-            string fileName = parameters[2];            
-            
-            TSDResult result = createLogicalDevice(logicalDeviceType,taskName,fileName);
-            m_properties.setValue(SD_PROPNAME_STATUS,GCFPVInteger(result));
-          }
-          else
-          {
-            TSDResult result = SD_RESULT_INCORRECT_NUMBER_OF_PARAMETERS;
-            m_properties.setValue(SD_PROPNAME_STATUS,GCFPVInteger(result));
-          }
-        }
-        // DESTROY_LOGICALDEVICE <name>
-        else if(command==string(SD_COMMAND_DESTROY_LOGICALDEVICE))
-        {
-          if(parameters.size()==1)
-          {
-            string name = parameters[0];
-            
-            TSDResult result = destroyLogicalDevice(name);
-            m_properties.setValue(SD_PROPNAME_STATUS,GCFPVInteger(result));
-          }
-          else
-          {
-            TSDResult result = SD_RESULT_INCORRECT_NUMBER_OF_PARAMETERS;
-            m_properties.setValue(SD_PROPNAME_STATUS,GCFPVInteger(result));
-          }
-        }
-        // STOP
-        else if(command==string(SD_COMMAND_STOP))
-        {
-          m_properties.setValue(SD_PROPNAME_STATUS,GCFPVInteger(SD_RESULT_SHUTDOWN));
-          stop();
-        }
-        else
-        {
-          TSDResult result = SD_RESULT_UNKNOWN_COMMAND;
-          m_properties.setValue(SD_PROPNAME_STATUS,GCFPVInteger(result));
-        }
-      }
-      break;
-    }  
-
-    default:
-      break;
-  }  
-}
-
-
-};
-};
diff --git a/MAC/APL/APLCommon/src/StartDaemon_Protocol.prot b/MAC/APL/APLCommon/src/StartDaemon_Protocol.prot
index 7711edd926b114e668d027fb5c102b795b5540b1..79f75c7357acac7849513d0e45b4408d0a315340 100644
--- a/MAC/APL/APLCommon/src/StartDaemon_Protocol.prot
+++ b/MAC/APL/APLCommon/src/StartDaemon_Protocol.prot
@@ -28,10 +28,16 @@ id = "(LOFAR::GCF::TM::F_APL_PROTOCOL+2)";
 // specify extra include files
 // e.g.
 // include = '<sys/time.h>';
-include = '<APL/APLCommon/APL_Defines.h>';
 
 prelude = << PRELUDE_END
-// define namespace and enumerations here
+
+enum {
+    SD_RESULT_UNSPECIFIED_ERROR = -4, 
+    SD_RESULT_UNSUPPORTED_LD, 
+    SD_RESULT_ALREADY_EXISTS,
+    SD_RESULT_LD_NOT_FOUND,
+    SD_RESULT_NO_ERROR 
+};
 
 PRELUDE_END;
 
@@ -42,46 +48,40 @@ PRELUDE_END;
 // A "param" has a "name" and a "type".
 //
 event = {
-  signal = SCHEDULE;
+  signal = CREATE;
   dir = IN;
   param = {
     name = "logicalDeviceType";
-    type = "APLCommon::TLogicalDeviceTypes";
+    type = "string";
   };
   param = {
     name = "taskName";
     type = "string";
   };
   param = {
-    name = "fileName";
+    name = "parentHost";
+    type = "string";
+  };
+  param = {
+    name = "parentService";
     type = "string";
   };
 };
 
 event = {
-  signal = SCHEDULED;
+  signal = CREATED;
   dir = OUT;
   param = {
-    name = "result";
-    type = "APLCommon::TSDResult";
+    name = "logicalDeviceType";
+    type = "string";
   };
   param = {
-    name = "VIrootID";
+    name = "taskName";
     type = "string";
   };
-};
-
-event = {
-  signal = DESTROY_LOGICALDEVICE;
-  dir = IN;
   param = {
-    name = "name";
-    type = "string";
+    name = "result";
+    type = "int32";
   };
 };
 
-event = {
-  signal = STOP;
-  dir = IN;
-};
-