diff --git a/MAC/APL/PAC/BS_Protocol/src/BS_Protocol.prot b/MAC/APL/PAC/BS_Protocol/src/BS_Protocol.prot
index a0c648fb8a92d25cb6c8f471f6f0bbac6afd124e..cf54dfe82dc4633836a7088e763977faf4dbf86f 100644
--- a/MAC/APL/PAC/BS_Protocol/src/BS_Protocol.prot
+++ b/MAC/APL/PAC/BS_Protocol/src/BS_Protocol.prot
@@ -29,7 +29,7 @@ typedef		void*		memptr_t;
 // The following signals are defined in the BS protocol
 //
 // BEAMALLOC     (name,   subarrayname, beamletAllocationMap);
-// BEAMALLOCACK  (handle, status);
+// BEAMALLOCACK  (subarrayname, handle, status);
 // BEAMMODIFY    (handle, beamletAllocationMap);
 // BEAMMODIFYACK (handle, status);
 // BEAMFREE      (handle);
@@ -49,45 +49,49 @@ PRELUDE_END;
 // A "param" has a "name" and a "type".
 //
 event = {
-      signal = BEAMALLOC;
-      dir = IN;
+	signal = BEAMALLOC;
+	dir = IN;
 
-      param = { // name of the beam (nodeid)
-	name = "name";
-	type = "string";
-      };
+	param = { // name of the beam (nodeid)
+		name = "name";
+		type = "string";
+	};
 
-      // Name of the station receptor group (SRG) on which this beam will be allocated.
-      // The SRG determines the sampling frequency and nyquist_zone.
-      param = {
-	    name = "subarrayname";
-	    type = "string";
-      };
+	// Name of the station receptor group (SRG) on which this beam will be allocated.
+	// The SRG determines the sampling frequency and nyquist_zone.
+	param = {
+		name = "subarrayname";
+		type = "string";
+	};
 
-      // how the subbands should be allocated to which beamlets
-      // e.g.
-      // beamlet 0 -> subband 384
-      // beamlet 1 -> subband 385
-      // beamlet 2 -> subband 386
-      // etc.
-      param = {
-	    name = "allocation";
-	    type = "Beamlet2SubbandMap";
-	    userdefined;
-      };
+	// how the subbands should be allocated to which beamlets
+	// e.g.
+	// beamlet 0 -> subband 384
+	// beamlet 1 -> subband 385
+	// beamlet 2 -> subband 386
+	// etc.
+	param = {
+		name = "allocation";
+		type = "Beamlet2SubbandMap";
+	userdefined;
+	};
 };
 
 event = {
-      signal = BEAMALLOCACK;
-      dir = OUT;
-      param = {
-	    name = "handle";
-	    type = "memptr_t";
-      };
-      param = {
-	    name = "status";
-	    type = "int16";
-      };
+	signal = BEAMALLOCACK;
+	dir = OUT;
+	param = {
+		name = "subarrayname";
+		type = "string";
+	};
+	param = {
+		name = "handle";
+		type = "memptr_t";
+	};
+	param = {
+		name = "status";
+		type = "int16";
+	};
 };
 
 event = {
@@ -160,19 +164,4 @@ event = {
 	    type = "Pointing";
             userdefined;
       };
-/*
-      param = {
-            // time at which the new direction should be effective
-	    name = "timestamp";
-	    type = "RTC::Timestamp";
-      };
-      param = {
-	    name = "type"; // BS_Protocol::J2000, AZEL or LOFAR_LMN
-	    type = "int16";
-      };
-      param = {
-	    name = "angle";
-	    type = "double[2]";
-      };
-*/
 };
diff --git a/MAC/APL/StationCU/src/BeamControl/BeamControl.cc b/MAC/APL/StationCU/src/BeamControl/BeamControl.cc
index 16b9931bc876c7ba9ea21b4c69d9804b974f76d6..897f6b6445cff1bb3c34a433cb6223947455acca 100644
--- a/MAC/APL/StationCU/src/BeamControl/BeamControl.cc
+++ b/MAC/APL/StationCU/src/BeamControl/BeamControl.cc
@@ -22,6 +22,7 @@
 #include <lofar_config.h>
 #include <Common/LofarLogger.h>
 
+#include <Common/StreamUtil.h>
 #include <APS/ParameterSet.h>
 #include <GCF/GCF_PVTypes.h>
 #include <GCF/Utils.h>
@@ -50,6 +51,7 @@ namespace LOFAR {
 	
 // static pointer to this object for signal handler
 static BeamControl*	thisBeamControl = 0;
+static uint16		gResult 		= CT_RESULT_NO_ERROR;
 
 //
 // BeamControl()
@@ -63,7 +65,7 @@ BeamControl::BeamControl(const string&	cntlrName) :
 	itsTimerPort		(0),
 	itsBeamServer		(0),
 	itsState			(CTState::NOSTATE),
-	itsBeamID			(0)
+	itsNrBeams			(0)
 {
 	LOG_TRACE_OBJ_STR (cntlrName << " construction");
 
@@ -209,16 +211,18 @@ GCFEvent::TResult BeamControl::initial_state(GCFEvent& event,
 
 			// update PVSS.
 			LOG_TRACE_FLOW ("Updateing state to PVSS");
-			itsPropertySet->setValue(PVSSNAME_FSM_CURACT,GCFPVString("initial"));
-			itsPropertySet->setValue(PVSSNAME_FSM_ERROR,GCFPVString(""));
-			itsPropertySet->setValue(PN_BC_CONNECTED,	GCFPVBool  (false));
-			itsPropertySet->setValue(PN_BC_SUBBANDLIST,	GCFPVString(""));
-			itsPropertySet->setValue(PN_BC_BEAMLETLIST,	GCFPVString(""));
-			itsPropertySet->setValue(PN_BC_ANGLE1,		GCFPVString(""));
-			itsPropertySet->setValue(PN_BC_ANGLE2,		GCFPVString(""));
-			itsPropertySet->setValue(PN_BC_ANGLETIMES,	GCFPVString(""));
-			itsPropertySet->setValue(PN_BC_SUBARRAY,	GCFPVString(""));
-//			itsPropertySet->setValue(PN_BC_BEAMID,		GCFPVInteger(0));
+			GCFPValueArray		dpeValues;
+			itsPropertySet->setValue(PVSSNAME_FSM_CURACT,	GCFPVString("initial"));
+			itsPropertySet->setValue(PVSSNAME_FSM_ERROR,	GCFPVString(""));
+			itsPropertySet->setValue(PN_BC_CONNECTED,		GCFPVBool  (false));
+			itsPropertySet->setValue(PN_BC_SUB_ARRAY,		GCFPVString(""));
+			itsPropertySet->setValue(PN_BC_SUBBAND_LIST,	GCFPVDynArr(LPT_DYNSTRING, dpeValues));
+			itsPropertySet->setValue(PN_BC_BEAMLET_LIST,	GCFPVDynArr(LPT_DYNSTRING, dpeValues));
+			itsPropertySet->setValue(PN_BC_ANGLE1,			GCFPVDynArr(LPT_DYNDOUBLE, dpeValues));
+			itsPropertySet->setValue(PN_BC_ANGLE2,			GCFPVDynArr(LPT_DYNDOUBLE, dpeValues));
+//			itsPropertySet->setValue(PN_BC_ANGLETIMES,		GCFPVDynArr(LPT_DYNUNSIGNED, dpeValues));
+			itsPropertySet->setValue(PN_BC_DIRECTION_TYPE,	GCFPVDynArr(LPT_DYNSTRING, dpeValues));
+			itsPropertySet->setValue(PN_BC_BEAM_NAME,		GCFPVDynArr(LPT_DYNSTRING, dpeValues));
 		  
 			// Start ParentControl task
 			LOG_DEBUG ("Enabling ParentControl task and wait for my name");
@@ -383,6 +387,8 @@ GCFEvent::TResult BeamControl::claimed_state(GCFEvent& event, GCFPortInterface&
 		CONTROLPrepareEvent		msg(event);
 		LOG_DEBUG_STR("Received PREPARE(" << msg.cntlrName << ")");
 		setState(CTState::PREPARE);
+// TODO
+		gResult = CT_RESULT_NO_ERROR;
 		// try to send a BEAMALLOC event to the BeamServer.
 		if (!doPrepare()) { // could not sent it?
 			LOG_WARN_STR("Beamallocation error: nr subbands != nr beamlets" << 
@@ -393,7 +399,7 @@ GCFEvent::TResult BeamControl::claimed_state(GCFEvent& event, GCFPortInterface&
 			sendControlResult(*itsParentPort, CONTROL_PREPARED, getName(), 
 															CT_RESULT_CONFLICTING_ARGS);
 		}
-		// else a BS_BEAMALLOCACK event will happen.
+		// else one or more BS_BEAMALLOCACK events will happen.
 		break;
 	}
 
@@ -404,20 +410,24 @@ GCFEvent::TResult BeamControl::claimed_state(GCFEvent& event, GCFPortInterface&
 	// -------------------- EVENTS RECEIVED FROM BEAMSERVER --------------------
 	case BS_BEAMALLOCACK: {
 		BSBeamallocackEvent		msg(event);
-		uint16 result  = handleBeamAllocAck(event);
-		if (result == CT_RESULT_NO_ERROR) {
-			setState(CTState::PREPARED);
-			LOG_INFO("Beam allocated, going to active state");
-			TRAN(BeamControl::active_state);
+		gResult |= handleBeamAllocAck(event);
+		if (itsBeamIDs.size() == itsNrBeams) {	// answer on all beams received?
+			if (gResult == CT_RESULT_NO_ERROR) {
+				setState(CTState::PREPARED);
+				LOG_INFO("Beam allocated, going to active state");
+				TRAN(BeamControl::active_state);
+			}
+			else {
+				LOG_WARN_STR("Beamallocation failed with error " << gResult << 
+							 ", staying in CLAIMED mode");
+				setState(CTState::CLAIMED);
+			}
+			LOG_DEBUG_STR("Sending PREPARED(" << getName() << "," << gResult << ") event");
+			sendControlResult(*itsParentPort, CONTROL_PREPARED, getName(), gResult);
 		}
 		else {
-			LOG_WARN_STR("Beamallocation failed with error " << result << 
-						 ", staying in CLAIMED mode");
-			setState(CTState::CLAIMED);
+			LOG_DEBUG_STR("Still waiting for " << itsNrBeams - itsBeamIDs.size() << " alloc answers");
 		}
-
-		LOG_DEBUG_STR("Sending PREPARED(" << getName() << "," << result << ") event");
-		sendControlResult(*itsParentPort, CONTROL_PREPARED, getName(), result);
 		break;
 	}
 
@@ -513,12 +523,10 @@ GCFEvent::TResult BeamControl::active_state(GCFEvent& event, GCFPortInterface& p
 	// -------------------- EVENTS RECEIVED FROM BEAMSERVER --------------------
 	case BS_BEAMFREEACK: {
 		if (!handleBeamFreeAck(event)) {
-			LOG_WARN("Error in freeing beam, staying in active_state");
-			sendControlResult(*itsParentPort, CONTROL_RELEASED, getName(), 
-															CT_RESULT_BEAMFREE_FAILED);
+			LOG_WARN("Error in freeing beam, trusting on disconnect.");
 		}
-		else {
-			LOG_INFO("Released beam going back to 'claimed' mode");
+		if (itsBeamIDs.empty()) {	// answer on all beams received?
+			LOG_INFO("Released beam(s) going back to 'claimed' mode");
 			setState(CTState::RELEASED);
 			sendControlResult(*itsParentPort, CONTROL_RELEASED, getName(), 
 															CT_RESULT_NO_ERROR);
@@ -595,50 +603,71 @@ GCFEvent::TResult BeamControl::quiting_state(GCFEvent& event, GCFPortInterface&
 //
 // doPrepare()
 //
+// Send an allocation event for every beam to the beamserver
+//
 bool BeamControl::doPrepare()
 {
 	Observation		theObs(globalParameterSet());	// does all nasty conversions
 
-	if (theObs.subbands.size() != theObs.beamlets.size()) {
-		LOG_FATAL_STR("size of subbandList (" << theObs.subbands.size() << ") != " <<
-						"size of beamletList (" << theObs.beamlets.size() << ")");
-		return (false);
-	}
+	GCFPValueArray		subbandArr;
+	GCFPValueArray		beamletArr;
+	GCFPValueArray		angle1Arr;
+	GCFPValueArray		angle2Arr;
+	GCFPValueArray		dirTypesArr;
+//	GCFPValueArray		angleTimesArr;
+	GCFPValueArray		beamIDArr;
+
+	itsNrBeams = theObs.beams.size();
+	LOG_DEBUG_STR("Controlling " << itsNrBeams << " beams.");
+
+	for (uint32	i(0); i < itsNrBeams; i++) {
+		if (theObs.beams[i].subbands.size() != theObs.beams[i].beamlets.size()) {
+			LOG_FATAL_STR("size of subbandList (" << theObs.beams[i].subbands.size() << ") != " <<
+							"size of beamletList (" << theObs.beams[i].beamlets.size() << ")");
+			return (false);
+		}
+
+		LOG_TRACE_VAR_STR("nr Subbands:" << theObs.beams[i].subbands.size());
+		LOG_TRACE_VAR_STR("nr Beamlets:" << theObs.beams[i].beamlets.size());
+
+		// contruct allocation event.
+		BSBeamallocEvent beamAllocEvent;
+		beamAllocEvent.name 		= getName();
+		beamAllocEvent.subarrayname = theObs.getBeamName(i);
+		LOG_DEBUG_STR("subarrayName:" << beamAllocEvent.subarrayname);
+
+		// construct subband to beamlet map
+		vector<int16>::iterator beamletIt = theObs.beams[i].beamlets.begin();
+		vector<int16>::iterator subbandIt = theObs.beams[i].subbands.begin();
+		while (beamletIt != theObs.beams[i].beamlets.end() && subbandIt != theObs.beams[i].subbands.end()) {
+			LOG_TRACE_VAR_STR("alloc[" << *beamletIt << "]=" << *subbandIt);
+			beamAllocEvent.allocation()[*beamletIt++] = *subbandIt++;
+		}
 
-	LOG_TRACE_VAR_STR("nr Subbands:" << theObs.subbands.size());
-	LOG_TRACE_VAR_STR("nr Beamlets:" << theObs.beamlets.size());
-
-	// contruct allocation event.
-	BSBeamallocEvent beamAllocEvent;
-	beamAllocEvent.name 		= getName();
-	beamAllocEvent.subarrayname = formatString("observation[%d]{%d}", getInstanceNr(getName()),
-																	getObservationNr(getName()));
-	LOG_DEBUG_STR("subarrayName:" << beamAllocEvent.subarrayname);
-
-	vector<int16>::iterator beamletIt = theObs.beamlets.begin();
-	vector<int16>::iterator subbandIt = theObs.subbands.begin();
-	while (beamletIt != theObs.beamlets.end() && subbandIt != theObs.subbands.end()) {
-		LOG_TRACE_VAR_STR("alloc[" << *beamletIt << "]=" << *subbandIt);
-		beamAllocEvent.allocation()[*beamletIt++] = *subbandIt++;
-	}
-
-	LOG_DEBUG_STR("Sending Alloc event to BeamServer");
-	itsBeamServer->send(beamAllocEvent);		// will result in BS_BEAMALLOCACK;
-
-	// store values in PVSS for operator
-	itsPropertySet->setValue(PN_BC_SUBBANDLIST,	
-				GCFPVString(APLUtilities::compactedArrayString(globalParameterSet()->
-				getString("Observation.subbandList"))));
-	itsPropertySet->setValue(PN_BC_BEAMLETLIST,	
-				GCFPVString(APLUtilities::compactedArrayString(globalParameterSet()->
-				getString("Observation.beamletList"))));
-	itsPropertySet->setValue(PN_BC_ANGLE1,		
-				GCFPVString(globalParameterSet()->getString("Observation.Beam.angle1")));
-	itsPropertySet->setValue(PN_BC_ANGLE2,		
-				GCFPVString(globalParameterSet()->getString("Observation.Beam.angle2")));
-	itsPropertySet->setValue(PN_BC_ANGLETIMES,	
-				GCFPVString(globalParameterSet()->getString("Observation.Beam.angleTimes")));
-	itsPropertySet->setValue(PN_BC_SUBARRAY, GCFPVString(beamAllocEvent.subarrayname));
+		LOG_DEBUG_STR("Sending Alloc event to BeamServer");
+		itsBeamServer->send(beamAllocEvent);		// will result in BS_BEAMALLOCACK;
+
+// TODO
+		// store values in PVSS for operator
+		stringstream		os;
+		writeVector(os, theObs.beams[i].subbands);
+		subbandArr.push_back   (new GCFPVString  (os.str()));
+		os.clear();
+		writeVector(os, theObs.beams[i].beamlets);
+		beamletArr.push_back   (new GCFPVString  (os.str()));
+		angle1Arr.push_back	   (new GCFPVDouble  (theObs.beams[i].angle1));
+		angle2Arr.push_back	   (new GCFPVDouble  (theObs.beams[i].angle2));
+		dirTypesArr.push_back  (new GCFPVString  (theObs.beams[i].directionType));
+//		angleTimesArr.push_back(new GCFPVUnsigned(theObs.beams[i].angleTimes));
+		beamIDArr.push_back	   (new GCFPVString  (""));
+	}
+
+	itsPropertySet->setValue(PN_BC_SUBBAND_LIST,	GCFPVDynArr(LPT_DYNSTRING, subbandArr));
+	itsPropertySet->setValue(PN_BC_BEAMLET_LIST,	GCFPVDynArr(LPT_DYNSTRING, beamletArr));
+	itsPropertySet->setValue(PN_BC_ANGLE1,			GCFPVDynArr(LPT_DYNDOUBLE, angle1Arr));
+	itsPropertySet->setValue(PN_BC_ANGLE2,			GCFPVDynArr(LPT_DYNDOUBLE, angle2Arr));
+//	itsPropertySet->setValue(PN_BC_ANGLETIMES,		GCFPVDynArr(LPT_DYNUINT,   angleTimesArr));
+	itsPropertySet->setValue(PN_BC_DIRECTION_TYPE,	GCFPVDynArr(LPT_DYNSTRING, dirTypesArr));
 
 	return (true);
 }
@@ -646,59 +675,41 @@ bool BeamControl::doPrepare()
 //
 // handleBeamAllocAck(event);
 //
+// When the allocation was succesfull send all pointing of that beam.
+//
 uint16	BeamControl::handleBeamAllocAck(GCFEvent&	event)
 {
 	// check the beam ID and status of the ACK message
 	BSBeamallocackEvent ackEvent(event);
 	if (ackEvent.status != 0) {
-		LOG_ERROR_STR("Beamlet allocation failed with errorcode: " << ackEvent.status);
+		LOG_ERROR_STR("Beamlet allocation for beam " << ackEvent.subarrayname 
+					  << " failed with errorcode: " << ackEvent.status);
+		itsBeamIDs[ackEvent.subarrayname] = 0;
 		return (CT_RESULT_BEAMALLOC_FAILED);
 	}
-	itsBeamID = ackEvent.handle;
-//	itsPropertySet->setValue(PN_BC_BEAMID, GCFPVInteger(itsBeamID));
+	itsBeamIDs[ackEvent.subarrayname] = ackEvent.handle;
+	LOG_INFO_STR("Beam " << ackEvent.subarrayname << " allocated succesful, sending pointings");
 
 	// read new angles from parameterfile.
-	vector<string>	sourceTimes;
-	vector<double>	angles1;
-	vector<double>	angles2;
-	string			beam(globalParameterSet()->locateModule("Beam")+"Beam.");
-	sourceTimes     = globalParameterSet()->getStringVector(beam+"angleTimes");
-	angles1    = globalParameterSet()->getDoubleVector(beam+"angle1");
-	angles2 = globalParameterSet()->getDoubleVector(beam+"angle2");
+	Observation		theObs(globalParameterSet());	// does all nasty conversions
+	uint32			beamIdx(indexValue(ackEvent.subarrayname, "[]")-1);
+	if (beamIdx >= theObs.beams.size()) {
+		LOG_FATAL_STR("Beamnr " << beamIdx+1 << " (=beam " << ackEvent.subarrayname << 
+						") is out of range: 1.." << theObs.beams.size());
+		return (CT_RESULT_BEAMALLOC_FAILED);
+	}
+	Observation::Beam*	theBeam = &theObs.beams[beamIdx];
 
 	// point the new beam
+	// NOTE: for the time being we don't support multiple pointings for a beam: no other sw supports it.
 	BSBeampointtoEvent beamPointToEvent;
-	beamPointToEvent.handle = itsBeamID;
+	beamPointToEvent.handle = ackEvent.handle;
 	beamPointToEvent.pointing.setType(static_cast<Pointing::Type>
-				(convertDirection(globalParameterSet()->getString(beam+"directionTypes"))));
-
-	// only 1 angle?
-	if (sourceTimes.size() == 0 || sourceTimes.size() != angles1.size() || 
-								  sourceTimes.size() != angles2.size()) {
-		// key sourceTimes not found: use one fixed angle
-		double	directionAngle1(0.0);
-		double	directionAngle2(0.0);
-		directionAngle1=globalParameterSet()->getDouble(beam+"angle1");
-		directionAngle2=globalParameterSet()->getDouble(beam+"angle2");
-
-		beamPointToEvent.pointing.setTime(RTC::Timestamp()); // asap
-		beamPointToEvent.pointing.setDirection(directionAngle1,directionAngle2);
-		itsBeamServer->send(beamPointToEvent);
-		// NB: will NOT result in an answer event of the beamserver.
-		return (CT_RESULT_NO_ERROR);
-	}
-
- 	// its a vecor with angles.
-	vector<double>::iterator angle1Iter    = angles1.begin();
-	vector<double>::iterator angle2Iter = angles2.begin();
-	for (vector<string>::iterator timesIt = sourceTimes.begin(); 
-								  timesIt != sourceTimes.end(); ++timesIt) { 
-		beamPointToEvent.pointing.setTime(RTC::Timestamp(
-										APLUtilities::decodeTimeString(*timesIt),0));
-		beamPointToEvent.pointing.setDirection(*angle1Iter++,*angle2Iter++);
-		itsBeamServer->send(beamPointToEvent);
-		// NB: will NOT result in an answer event of the beamserver.
-	}
+				(convertDirection(theBeam->directionType)));
+
+	beamPointToEvent.pointing.setTime(RTC::Timestamp()); // asap
+	beamPointToEvent.pointing.setDirection(theBeam->angle1,theBeam->angle2);
+	itsBeamServer->send(beamPointToEvent);
 	return (CT_RESULT_NO_ERROR);
 }
 
@@ -707,13 +718,19 @@ uint16	BeamControl::handleBeamAllocAck(GCFEvent&	event)
 //
 bool BeamControl::doRelease()
 {
-	if (!itsBeamID) {
+	if (itsBeamIDs.empty()) {
+		LOG_DEBUG ("doRelease: beam-map is empty");
 		return (false);
 	}
 
 	BSBeamfreeEvent		beamFreeEvent;
-	beamFreeEvent.handle = itsBeamID;
-	itsBeamServer->send(beamFreeEvent);	// will result in BS_BEAMFREEACK event
+	map<string, void*>::iterator	iter = itsBeamIDs.begin();
+	map<string, void*>::iterator	end  = itsBeamIDs.end();
+	while (iter != end) {
+		beamFreeEvent.handle = iter->second;
+		itsBeamServer->send(beamFreeEvent);	// will result in BS_BEAMFREEACK event
+		iter++;
+	}
 	return (true);
 }
 
@@ -724,23 +741,32 @@ bool BeamControl::doRelease()
 bool BeamControl::handleBeamFreeAck(GCFEvent&		event)
 {
 	BSBeamfreeackEvent	ack(event);
-	if (ack.status != 0 || ack.handle != itsBeamID) {
-		LOG_ERROR_STR("Beamlet de-allocation failed with errorcode: " << ack.status);
-		itsPropertySet->setValue(PVSSNAME_FSM_ERROR,GCFPVString("De-allocation of the beamlet failed."));
+	if (ack.status != 0) {
+		LOG_ERROR_STR("Beam de-allocation failed with errorcode: " << ack.status);
+		itsPropertySet->setValue(PVSSNAME_FSM_ERROR,GCFPVString("De-allocation of the beam failed."));
 		return (false);	
 	}
 
-	// clear beam in PVSS
-	itsPropertySet->setValue(PN_BC_SUBBANDLIST,	GCFPVString(""));
-	itsPropertySet->setValue(PN_BC_BEAMLETLIST,	GCFPVString(""));
-	itsPropertySet->setValue(PN_BC_ANGLE1,		GCFPVString(""));
-	itsPropertySet->setValue(PN_BC_ANGLE2,		GCFPVString(""));
-	itsPropertySet->setValue(PN_BC_ANGLETIMES,	GCFPVString(""));
-//	itsPropertySet->setValue(PN_BC_BEAMID,		GCFPVInteger(0));
-
-	itsBeamID = 0;
-
-	return (true);
+	map<string, void*>::iterator	iter = itsBeamIDs.begin();
+	map<string, void*>::iterator	end  = itsBeamIDs.end();
+	while(iter != end) {
+		if (iter->second == ack.handle) {
+			// clear beam in PVSS
+#if 0
+			// TODO: those fields are dynArrays.
+			itsPropertySet->setValue(PN_BC_SUBBAND_LIST,	GCFPVString(""));
+			itsPropertySet->setValue(PN_BC_BEAMLET_LIST,	GCFPVString(""));
+			itsPropertySet->setValue(PN_BC_ANGLE1,			GCFPVString(""));
+			itsPropertySet->setValue(PN_BC_ANGLE2,			GCFPVString(""));
+		//	itsPropertySet->setValue(PN_BC_ANGLETIMES,		GCFPVString(""));
+#endif
+			LOG_INFO_STR("De-allocation of beam " << iter->first << " succesful");
+			itsBeamIDs.erase(iter);
+			return (true);
+		}
+		iter++;
+	}
+	return (false);
 }
 
 // _defaultEventHandler(event, port)
diff --git a/MAC/APL/StationCU/src/BeamControl/BeamControl.h b/MAC/APL/StationCU/src/BeamControl/BeamControl.h
index 63d5f18c9aa67e388cd5223cb3f0c72edc08e280..41a02ffb1881142cf64f94588557c40734af05ec 100644
--- a/MAC/APL/StationCU/src/BeamControl/BeamControl.h
+++ b/MAC/APL/StationCU/src/BeamControl/BeamControl.h
@@ -112,7 +112,8 @@ private:
 	// ParameterSet variables
 	string					itsTreePrefix;
 	uint32					itsInstanceNr;
-	void*					itsBeamID;				// returned from BeamServer
+	uint32					itsNrBeams;
+	map<string, void*>		itsBeamIDs;				// returned from BeamServer
 };
 
   };//StationCU
diff --git a/MAC/APL/StationCU/src/BeamControl/BeamControlDefines.h b/MAC/APL/StationCU/src/BeamControl/BeamControlDefines.h
index 9e4a5fd9c4a35647a16a7bc82b268f54af564ff9..90906de7d314d81ad6562aa81105c1cd2e675c93 100644
--- a/MAC/APL/StationCU/src/BeamControl/BeamControlDefines.h
+++ b/MAC/APL/StationCU/src/BeamControl/BeamControlDefines.h
@@ -28,16 +28,16 @@ namespace LOFAR {
 
 #define BC_TASKNAME					"BeamCtrl"
 
-#define PSN_BEAM_CTRL   			"LOFAR_ObsSW_@observation@_BeamCtrl"
-#define PST_BEAM_CTRL   			"BeamCtrl"
-#define PN_BC_CONNECTED 			"connected"
-#define PN_BC_SUBBANDLIST 			"subbandList"
-#define PN_BC_BEAMLETLIST 			"beamletList"
-#define PN_BC_SUBARRAY 				"subArray"
-#define PN_BC_ANGLE1 				"angle1"
-#define PN_BC_ANGLE2	 			"angle2"
-#define PN_BC_ANGLETIMES 			"angleTimes"
-#define PN_BC_BEAMID 				"beamID"
+#define PSN_BEAM_CTRL				"LOFAR_ObsSW_@observation@_BeamCtrl"
+#define PST_BEAM_CTRL				"BeamCtrl"
+#define PN_BC_CONNECTED				"connected"
+#define PN_BC_SUB_ARRAY				"subArray"
+#define PN_BC_SUBBAND_LIST 			"subbandList"
+#define PN_BC_BEAMLET_LIST 			"beamletList"
+#define PN_BC_ANGLE1   				"angle1"
+#define PN_BC_ANGLE2   				"angle2"
+#define PN_BC_DIRECTION_TYPE   		"directionType"
+#define PN_BC_BEAM_NAME				"beamName"
 
 // next lines should be defined somewhere in Common.
 #define PVSSNAME_FSM_CURACT			"currentAction"
diff --git a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.cc b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.cc
index e7537d8f9ce40b636d231667610cd75420ff0b39..72266e7df4a6541fd1d279d90d389bcfd7849719 100644
--- a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.cc
+++ b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.cc
@@ -46,6 +46,7 @@ namespace LOFAR {
 	
 // static pointer to this object for signal handler
 static CalibrationControl*	thisCalibrationControl = 0;
+static uint16				gResult = CT_RESULT_NO_ERROR;
 
 //
 // CalibrationControl()
@@ -147,17 +148,12 @@ int32 CalibrationControl::convertFilterSelection(const string&	filterselection)
 	if (filterselection == "LBL_30_80")		{ return(2); }
 	if (filterselection == "LBH_10_80")		{ return(3); }
 	if (filterselection == "LBH_30_80")		{ return(4); }
-	if (filterselection == "HB_100_190") 	{ return(5); }
-	if (filterselection == "HB_170_230") 	{ return(6); }
-	if (filterselection == "HB_210_240") 	{ return(7); }
-
-	// those will become obsolete!
-	if (filterselection == "LBL_10_90")		{ return(1); }
-	if (filterselection == "LBH_10_90")		{ return(3); }
-	if (filterselection == "HB_210_250") 	{ return(7); }
+	if (filterselection == "HB_100_190")	{ return(5); }
+	if (filterselection == "HB_170_230")	{ return(6); }
+	if (filterselection == "HB_210_240")	{ return(7); }
 
 	LOG_WARN_STR ("filterselection value '" << filterselection << 
-											"' not recognized, using LBL_10_80");
+									"' not recognized, using LBL_10_80");
 	return (1);
 }
 
@@ -216,10 +212,11 @@ GCFEvent::TResult CalibrationControl::initial_state(GCFEvent& event,
 
 			// update PVSS.
 			LOG_TRACE_FLOW ("Updateing state to PVSS");
+			GCFPValueArray		beamNameArr;
 			itsPropertySet->setValue(PVSSNAME_FSM_CURACT,GCFPVString ("initial"));
 			itsPropertySet->setValue(PVSSNAME_FSM_ERROR,GCFPVString (""));
 			itsPropertySet->setValue(PN_CC_CONNECTED,	GCFPVBool   (false));
-			itsPropertySet->setValue(PN_CC_OBSNAME,		GCFPVString (""));
+			itsPropertySet->setValue(PN_CC_BEAMNAMES,	GCFPVDynArr (LPT_DYNSTRING, beamNameArr));
 			itsPropertySet->setValue(PN_CC_ANTENNAARRAY,GCFPVString (""));
 			itsPropertySet->setValue(PN_CC_FILTER,		GCFPVString (""));
 			itsPropertySet->setValue(PN_CC_NYQUISTZONE,	GCFPVInteger(0));
@@ -361,8 +358,9 @@ GCFEvent::TResult CalibrationControl::claimed_state(GCFEvent& 		  event,
 
 	case F_ENTRY: {
 		// update PVSS
+		GCFPValueArray		beamNameArr;
 		itsPropertySet->setValue(PVSSNAME_FSM_ERROR, GCFPVString (""));
-		itsPropertySet->setValue(PN_CC_OBSNAME,		 GCFPVString (""));
+		itsPropertySet->setValue(PN_CC_BEAMNAMES,	 GCFPVDynArr (LPT_DYNSTRING, beamNameArr));
 		itsPropertySet->setValue(PN_CC_ANTENNAARRAY, GCFPVString (""));
 		itsPropertySet->setValue(PN_CC_FILTER,		 GCFPVString (""));
 		itsPropertySet->setValue(PN_CC_NYQUISTZONE,	 GCFPVInteger(0));
@@ -386,6 +384,7 @@ GCFEvent::TResult CalibrationControl::claimed_state(GCFEvent& 		  event,
 		CONTROLPrepareEvent		msg(event);
 		LOG_DEBUG_STR("Received PREPARE(" << msg.cntlrName << ")");
 		setState(CTState::PREPARE);
+		gResult = CT_RESULT_NO_ERROR;
 		if (!startCalibration()) {	// will result in CAL_STARTACK event
 			sendControlResult(port, CONTROL_PREPARED, msg.cntlrName, 
 														CT_RESULT_CALSTART_FAILED);
@@ -401,18 +400,29 @@ GCFEvent::TResult CalibrationControl::claimed_state(GCFEvent& 		  event,
 	// -------------------- EVENTS RECEIVED FROM CALSERVER --------------------
 	case CAL_STARTACK: {
 		CALStartackEvent		ack(event);
+		gResult |= ack.status;		// update overall result
 		if (ack.status == SUCCESS || ack.status == ERR_ALREADY_REGISTERED) {
-			LOG_INFO ("Start of calibration was succesful");
-			sendControlResult(*itsParentPort, CONTROL_PREPARED, getName(),
-																CT_RESULT_NO_ERROR);
-			setState(CTState::PREPARED);
-			TRAN(CalibrationControl::active_state);			// go to next state.
+			LOG_INFO_STR ("Start of the calibration of beam " << ack.name << " was succesful");
+			itsBeams[ack.name] = true;					// add to beammap
 		}
 		else {
-			LOG_ERROR("Start of calibration failed, staying in CLAIMED mode");
-			sendControlResult(*itsParentPort, CONTROL_PREPARED, getName(),
-															CT_RESULT_CALSTART_FAILED);
-			setState(CTState::CLAIMED);
+			LOG_ERROR_STR("Start of calibration of beam " << ack.name << 
+															" failed, staying in CLAIMED mode");
+			itsBeams[ack.name] = false;					// add to beammap
+		}
+
+		if (itsObsPar.beams.size() == itsBeams.size()) {	// answer for all beams received? report state
+			if (gResult == SUCCESS || gResult == ERR_ALREADY_REGISTERED) {
+				LOG_INFO("Calibration of all beams started sucesfully, going to active-mode");
+				sendControlResult(*itsParentPort, CONTROL_PREPARED, getName(), CT_RESULT_NO_ERROR);
+				setState(CTState::PREPARED);
+				TRAN(CalibrationControl::active_state);			// go to next state.
+			}
+			else {
+				LOG_INFO("Not all beams were calibrated right, staying in claiming mode");
+				sendControlResult(*itsParentPort, CONTROL_PREPARED, getName(), CT_RESULT_CALSTART_FAILED);
+				setState(CTState::CLAIMED);
+			}
 		}
 	}
 	break;
@@ -481,6 +491,7 @@ GCFEvent::TResult CalibrationControl::active_state(GCFEvent& event, GCFPortInter
 		CONTROLReleaseEvent		msg(event);
 		LOG_DEBUG_STR("Received RELEASED(" << msg.cntlrName << ")");
 		setState(CTState::RELEASE);
+		gResult = CT_RESULT_NO_ERROR;
 		if (!stopCalibration()) {	// will result in CAL_STOPACK event
 			sendControlResult(port,CONTROL_RELEASED, getName(), CT_RESULT_CALSTOP_FAILED);
 		}
@@ -496,18 +507,38 @@ GCFEvent::TResult CalibrationControl::active_state(GCFEvent& event, GCFPortInter
 
 	case CAL_STOPACK: {
 		CALStopackEvent			ack(event);
+		gResult |= ack.status;
 		if (ack.status == SUCCESS) {
-			LOG_INFO ("Calibration successfully stopped");
-			sendControlResult(*itsParentPort, CONTROL_RELEASED, getName(), 
-															CT_RESULT_NO_ERROR);
-			setState(CTState::RELEASED);
-			TRAN(CalibrationControl::claimed_state);			// go to next state.
+			LOG_INFO_STR ("Calibration of beam " << ack.name << " successfully stopped");
 		}
 		else {
-			LOG_ERROR("Stop of calibration failed, going to SUSPENDED mode");
-			sendControlResult(*itsParentPort, CONTROL_RELEASED, getName(), 
-															CT_RESULT_CALSTOP_FAILED);
-			setState(CTState::SUSPENDED);
+			LOG_WARN_STR ("Calibration of beam " << ack.name << " stopped with ERRORs");
+		}
+
+		// remove beam from the map
+		map<string, bool>::iterator	iter = itsBeams.begin();
+		map<string, bool>::iterator	end  = itsBeams.end ();
+		while(iter != end) {
+			if (iter->first == ack.name) {
+				itsBeams.erase(iter);
+				break;
+			}
+			iter++;
+		}
+
+		if (itsBeams.empty()) {		// all beams stopped?
+			if (gResult == SUCCESS) {
+				LOG_INFO("All calibrations stopped, going to RELEASED state");
+				sendControlResult(*itsParentPort, CONTROL_RELEASED, getName(), CT_RESULT_NO_ERROR);
+				setState(CTState::RELEASED);
+				TRAN(CalibrationControl::claimed_state);			// go to next state.
+			}
+			else {
+				LOG_ERROR("Stop of some calibrations failed, staying in SUSPENDED mode");
+				sendControlResult(*itsParentPort, CONTROL_RELEASED, getName(), 
+																CT_RESULT_CALSTOP_FAILED);
+				setState(CTState::SUSPENDED);
+			}
 		}
 		break;
 	}
@@ -583,33 +614,40 @@ GCFEvent::TResult CalibrationControl::quiting_state(GCFEvent& 		  event,
 //
 bool	CalibrationControl::startCalibration() 
 {
-	// construct and send CALStartEvent
-	string		obsName(formatString("observation[%d]{%d}", getInstanceNr(getName()), 
-															getObservationNr(getName())));
-	CALStartEvent calStartEvent;
-	calStartEvent.name   	   = obsName;
-	calStartEvent.parent 	   = itsObsPar.antennaArray;
-	calStartEvent.rcumode().resize(1);
-	calStartEvent.rcumode()(0).setMode((RSP_Protocol::RCUSettings::Control::RCUMode)
-										convertFilterSelection(itsObsPar.filter));
-//	calStartEvent.nyquist_zone = itsObsPar.nyquistZone;
-//	calStartEvent.rcumode()(0).setSpecinv(calStartEvent.rcumode()(0).getNyquistZone() == 2);
-	calStartEvent.subset 	   = itsObsPar.RCUset;
-	LOG_DEBUG(formatString("Sending CALSTART(%s,%s,%08X)", 
-							obsName.c_str(), calStartEvent.parent.c_str(),
-							calStartEvent.rcumode()(0).getRaw()));
-
-	itsCalServer->send(calStartEvent);
+	uint32	nrBeams = itsObsPar.beams.size();
+	LOG_DEBUG_STR("Calibrating " << nrBeams << " beams.");
+
+	GCFPValueArray		beamNameArr;
+	for (uint32	i(0); i < nrBeams; i++) {
+		// construct and send CALStartEvent
+		string		beamName(itsObsPar.getBeamName(i));
+
+		CALStartEvent calStartEvent;
+		calStartEvent.name   	   = beamName;
+		calStartEvent.parent 	   = itsObsPar.antennaArray;
+		calStartEvent.rcumode().resize(1);
+		calStartEvent.rcumode()(0).setMode((RSP_Protocol::RCUSettings::Control::RCUMode)
+											convertFilterSelection(itsObsPar.filter));
+	//	calStartEvent.nyquist_zone = itsObsPar.nyquistZone;
+	//	calStartEvent.rcumode()(0).setSpecinv(calStartEvent.rcumode()(0).getNyquistZone() == 2);
+		calStartEvent.subset 	   = itsObsPar.RCUset;
+		LOG_DEBUG(formatString("Sending CALSTART(%s,%s,%08X)", 
+								beamName.c_str(), calStartEvent.parent.c_str(),
+								calStartEvent.rcumode()(0).getRaw()));
+
+		itsCalServer->send(calStartEvent);
+		beamNameArr.push_back(new GCFPVString(beamName));	// update array for PVSS
+
+	} // for all beams
 
 	// inform operator about these values.
-	itsPropertySet->setValue(PN_CC_OBSNAME,		GCFPVString(obsName));
+	itsPropertySet->setValue(PN_CC_BEAMNAMES,	GCFPVDynArr(LPT_DYNSTRING, beamNameArr));
 	itsPropertySet->setValue(PN_CC_ANTENNAARRAY,GCFPVString(itsObsPar.antennaArray));
 	itsPropertySet->setValue(PN_CC_FILTER,		GCFPVString(itsObsPar.filter));
 	itsPropertySet->setValue(PN_CC_NYQUISTZONE,	GCFPVInteger(itsObsPar.nyquistZone));
 	itsPropertySet->setValue(PN_CC_RCUS,		GCFPVString(
-		APLUtilities::compactedArrayString(globalParameterSet()->
-		getString("Observation.receiverList"))));
-
+										APLUtilities::compactedArrayString(globalParameterSet()->
+										getString("Observation.receiverList"))));
 	return (true);
 }
 
@@ -619,13 +657,17 @@ bool	CalibrationControl::startCalibration()
 //
 bool	CalibrationControl::stopCalibration()
 {
-	// send CALStopEvent
-	string		obsName(formatString("observation[%d]{%d}", getInstanceNr(getName()), 
-															getObservationNr(getName())));
-	LOG_DEBUG_STR ("Sending CALSTOP(" << obsName << ") to CALserver");
-	CALStopEvent calStopEvent;
-	calStopEvent.name = obsName;
-	itsCalServer->send(calStopEvent);
+	uint32 nrBeams = itsObsPar.beams.size();
+	LOG_DEBUG_STR("Stopping calibration of " << nrBeams << " beams.");
+
+	for (uint32	i(0); i < nrBeams; i++) {
+		// send CALStopEvent
+		string		beamName(itsObsPar.getBeamName(i));
+		LOG_DEBUG_STR ("Sending CALSTOP(" << beamName << ") to CALserver");
+		CALStopEvent calStopEvent;
+		calStopEvent.name = beamName;
+		itsCalServer->send(calStopEvent);
+	}
 
 	return (true);
 }
diff --git a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.h b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.h
index b48bd97896405c18638ba7b900aa7c55b73c1381..9b80dd91bee8fc2ba3663bd4074bfa5d0eacd44e 100644
--- a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.h
+++ b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControl.h
@@ -97,6 +97,7 @@ private:
 	GCFTimerPort*			itsTimerPort;		// general port for timers
 	GCFTCPPort*				itsCalServer;		// connection with CalServer
 	CTState::CTstateNr		itsState;			// 
+	map<string, bool>		itsBeams;			// beam active or not.
 
 	// ParameterSet variables
 	string					itsTreePrefix;
diff --git a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlDefines.h b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlDefines.h
index d65bc691d05367f10a86600ba5ecb1eec9c9a95f..2ec790471ba0a951d8e66ae93d3ad95ddb6e8896 100644
--- a/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlDefines.h
+++ b/MAC/APL/StationCU/src/CalibrationControl/CalibrationControlDefines.h
@@ -31,14 +31,12 @@ namespace LOFAR {
 #define PSN_CAL_CTRL				"LOFAR_ObsSW_@observation@_CalCtrl"
 #define PST_CAL_CTRL				"CalCtrl"
 #define PN_CC_CONNECTED				"connected"
-#define PN_CC_OBSNAME				"obsname"
+#define PN_CC_BEAMNAMES				"beamnames"
 #define PN_CC_ANTENNAARRAY			"antennaArray"
 #define PN_CC_FILTER				"filter"
 #define PN_CC_NYQUISTZONE			"nyquistzone"
 #define PN_CC_RCUS					"rcus"
 
-#define PROPNAME_FUNCTIONALITY		"functionality"
-
 // next lines should be defined somewhere in Common.
 #define PVSSNAME_FSM_CURACT			"currentAction"
 #define PVSSNAME_FSM_ERROR			"error"
diff --git a/MAC/APL/StationCU/src/StationControl/ActiveObs.cc b/MAC/APL/StationCU/src/StationControl/ActiveObs.cc
index afefa18baa62839bed4332cd01e41a8f1eda162f..975fa175e8a85693271c75009a88ff0687d8d2cf 100644
--- a/MAC/APL/StationCU/src/StationControl/ActiveObs.cc
+++ b/MAC/APL/StationCU/src/StationControl/ActiveObs.cc
@@ -72,11 +72,11 @@ ActiveObs::ActiveObs(const string&		name,
 	itsCalCntlrReady	(false),
 	itsTBBCntlrReady	(false),
 	itsBeamCntlrName	(controllerName(CNTLRTYPE_BEAMCTRL, 
-						 itsInstanceNr, itsObsPar.treeID)),
+						 itsInstanceNr, itsObsPar.obsID)),
 	itsCalCntlrName		(controllerName(CNTLRTYPE_CALIBRATIONCTRL, 
-						 itsInstanceNr, itsObsPar.treeID)),
+						 itsInstanceNr, itsObsPar.obsID)),
 	itsTBBCntlrName		(controllerName(CNTLRTYPE_TBBCTRL, 
-						 itsInstanceNr, itsObsPar.treeID)),
+						 itsInstanceNr, itsObsPar.obsID)),
 	itsReadyFlag		(false),
 	itsReqState			(CTState::NOSTATE),
 	itsCurState			(CTState::NOSTATE)
@@ -177,14 +177,14 @@ GCFEvent::TResult	ActiveObs::starting(GCFEvent&	event, GCFPortInterface&	port)
 		itsReqState = CTState::CREATED;
 		LOG_DEBUG_STR("Starting controller " << itsCalCntlrName);
 		ChildControl::instance()->startChild(CNTLRTYPE_CALIBRATIONCTRL,
-											 itsObsPar.treeID,
+											 itsObsPar.obsID,
 											 itsInstanceNr,
 											 myHostname(false));
 		// Results in CONTROL_CONNECT in StationControl Task.
 											
 		LOG_DEBUG_STR("Starting controller " << itsBeamCntlrName);
 		ChildControl::instance()->startChild(CNTLRTYPE_BEAMCTRL,
-											 itsObsPar.treeID,
+											 itsObsPar.obsID,
 											 itsInstanceNr,
 											 myHostname(false));
 		// Results in CONTROL_CONNECT in StationControl Task.
@@ -192,7 +192,7 @@ GCFEvent::TResult	ActiveObs::starting(GCFEvent&	event, GCFPortInterface&	port)
 		if (itsUsesTBB) {
 			LOG_DEBUG_STR("Starting controller " << itsTBBCntlrName);
 			ChildControl::instance()->startChild(CNTLRTYPE_TBBCTRL,
-												 itsObsPar.treeID,
+												 itsObsPar.obsID,
 												 itsInstanceNr,
 												 myHostname(false));
 			// Results in CONTROL_CONNECT in StationControl Task.
@@ -660,7 +660,7 @@ ostream& ActiveObs::print (ostream& os) const
 {
 	os << "ACTIVEOBS         : " << itsName << endl;
 	os << "instancenr        : " << itsInstanceNr << endl;
-	os << "treeid            : " << itsObsPar.treeID << endl;
+	os << "treeid            : " << itsObsPar.obsID << endl;
 	os << "nyquistZone       : " << itsObsPar.nyquistZone << endl;
 	os << "sampleClock       : " << itsObsPar.sampleClock << endl;
 	os << "filter            : " << itsObsPar.filter << endl;
diff --git a/MAC/APL/TestCtlr/src/ControllerMenu.cc b/MAC/APL/TestCtlr/src/ControllerMenu.cc
index f5fe7bf0cf7f08fac506b42aedd02b8f555d24d3..199ed35fb2266aa0ed52c9436c9339a4b140f1fb 100644
--- a/MAC/APL/TestCtlr/src/ControllerMenu.cc
+++ b/MAC/APL/TestCtlr/src/ControllerMenu.cc
@@ -49,7 +49,7 @@ namespace LOFAR {
 //
 // ControllerMenu()
 //
-ControllerMenu::ControllerMenu() :
+ControllerMenu::ControllerMenu(uint32	instanceNr) :
 	GCFTask 			((State)&ControllerMenu::initial_state,string("TestCtlr")),
 	itsTimerPort		(0),
 	itsChildControl		(0),
@@ -58,7 +58,8 @@ ControllerMenu::ControllerMenu() :
 	itsQueuePeriod		(0),
 	itsClaimPeriod		(0),
 	itsStartTime		(),
-	itsStopTime			()
+	itsStopTime			(),
+	itsInstanceNr		(instanceNr)
 {
 	LOG_TRACE_OBJ ("ControllerMenu construction");
 
@@ -102,7 +103,7 @@ GCFEvent::TResult ControllerMenu::initial_state(GCFEvent& event, GCFPortInterfac
     case F_INIT:
 		// Start ChildControl task
 		LOG_DEBUG ("Enabling ChildControltask");
-		itsChildControl->openService(MAC_SVCMASK_APLTEST_CTLRMENU, 0);
+		itsChildControl->openService(MAC_SVCMASK_APLTEST_CTLRMENU, itsInstanceNr);
 		itsChildControl->registerCompletionPort(itsChildPort);
 		cout << "Waiting till other tasks are ready...";
 		itsTimerPort->setTimer(2.0);	// give other task some time.
@@ -144,10 +145,10 @@ GCFEvent::TResult ControllerMenu::startup_state(GCFEvent& event, GCFPortInterfac
 	case F_ENTRY: {
 			// Start ChildControl task
 			cout << "Starting up controller ... ";
-			string		cntlrName = controllerName(itsCntlrType, 0, itsObsNr);
+			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->startChild(itsCntlrType,
 											 itsObsNr,
-											 0,
+											 itsInstanceNr,
 											 myHostname(false))) {
 				cout << "Error during start of controller, bailing out" << endl;
 				stop();
@@ -211,7 +212,7 @@ GCFEvent::TResult ControllerMenu::claim_state(GCFEvent& event, GCFPortInterface&
 	case F_ENTRY: {
 			// Start ChildControl task
 			cout << "Requesting controller to goto CLAIM state..." << endl;;
-			string		cntlrName = controllerName(itsCntlrType, 0, itsObsNr);
+			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->requestState(CTState::CLAIMED, cntlrName, itsObsNr, itsCntlrType)) {
 				cout << "Error during state request, bailing out" << endl;
 				stop();
@@ -262,7 +263,7 @@ GCFEvent::TResult ControllerMenu::prepare_state(GCFEvent& event, GCFPortInterfac
 	case F_ENTRY: {
 			// Start ChildControl task
 			cout << "Requesting controller to goto PREPARE state..." << endl;;
-			string		cntlrName = controllerName(itsCntlrType, 0, itsObsNr);
+			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->requestState(CTState::PREPARED, cntlrName, itsObsNr, itsCntlrType)) {
 				cout << "Error during state request, bailing out" << endl;
 				stop();
@@ -312,7 +313,7 @@ GCFEvent::TResult ControllerMenu::run_state(GCFEvent& event, GCFPortInterface& /
 	case F_ENTRY: {
 			// Start ChildControl task
 			cout << "Requesting controller to goto RUN state..." << endl;;
-			string		cntlrName = controllerName(itsCntlrType, 0, itsObsNr);
+			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->requestState(CTState::RESUMED, cntlrName, itsObsNr, itsCntlrType)) {
 				cout << "Error during state request, bailing out" << endl;
 				stop();
@@ -362,7 +363,7 @@ GCFEvent::TResult ControllerMenu::suspend_state(GCFEvent& event, GCFPortInterfac
 	case F_ENTRY: {
 			// Start ChildControl task
 			cout << "Requesting controller to goto SUSPEND state..." << endl;;
-			string		cntlrName = controllerName(itsCntlrType, 0, itsObsNr);
+			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->requestState(CTState::SUSPENDED, cntlrName, itsObsNr, itsCntlrType)) {
 				cout << "Error during state request, bailing out" << endl;
 				stop();
@@ -412,7 +413,7 @@ GCFEvent::TResult ControllerMenu::release_state(GCFEvent& event, GCFPortInterfac
 	case F_ENTRY: {
 			// Start ChildControl task
 			cout << "Requesting controller to goto RELEASED state..." << endl;;
-			string		cntlrName = controllerName(itsCntlrType, 0, itsObsNr);
+			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->requestState(CTState::RELEASED, cntlrName, itsObsNr, itsCntlrType)) {
 				cout << "Error during state request, bailing out" << endl;
 				stop();
@@ -462,7 +463,7 @@ GCFEvent::TResult ControllerMenu::finish_state(GCFEvent& event, GCFPortInterface
 	case F_ENTRY: {
 			// Start ChildControl task
 			cout << "Telling controller we are FINISHED ..." << endl;;
-			string		cntlrName = controllerName(itsCntlrType, 0, itsObsNr);
+			string		cntlrName = controllerName(itsCntlrType, itsInstanceNr, itsObsNr);
 			if (!itsChildControl->requestState(CTState::QUITED, cntlrName, itsObsNr, itsCntlrType)) {
 				cout << "Error during state request, bailing out" << endl;
 				stop();
diff --git a/MAC/APL/TestCtlr/src/ControllerMenu.h b/MAC/APL/TestCtlr/src/ControllerMenu.h
index 7cb3e46ca61a7462d110f6c3af65f063e83ec1ba..d13bc4e3c3873742c9bea88bec2871d92fb6da5e 100644
--- a/MAC/APL/TestCtlr/src/ControllerMenu.h
+++ b/MAC/APL/TestCtlr/src/ControllerMenu.h
@@ -64,7 +64,7 @@ using	APLCommon::ChildControl;
 class ControllerMenu : public GCFTask
 {
 public:
-	ControllerMenu();
+	ControllerMenu(uint32	instanceNr = 0);
 	~ControllerMenu();
 
    	GCFEvent::TResult initial_state (GCFEvent& e, GCFPortInterface& p);
@@ -105,6 +105,7 @@ private:
 
 	uint16				itsCntlrType;
 	uint32				itsObsNr;
+	uint32				itsInstanceNr;
 };
 
   };//Test
diff --git a/MAC/APL/TestCtlr/src/ControllerMenuMain.cc b/MAC/APL/TestCtlr/src/ControllerMenuMain.cc
index fe5ec594e122eb83a94452614b2012063affec52..96bba20ba6fa5039ad074b1e2d3000cea134f444 100644
--- a/MAC/APL/TestCtlr/src/ControllerMenuMain.cc
+++ b/MAC/APL/TestCtlr/src/ControllerMenuMain.cc
@@ -35,7 +35,7 @@ int main(int argc, char* argv[])
 	ChildControl*	cc = ChildControl::instance();
 	cc->start();	// make initial transition
 
-	ControllerMenu	tc;
+	ControllerMenu	tc(argc == 2 ? atoi(argv[1]) : 0);
 	tc.start(); // make initial transition
 
 	GCFTask::run();
diff --git a/MAC/Deployment/data/bin/load_OTDB_comps.cc b/MAC/Deployment/data/bin/load_OTDB_comps.cc
index a472838e9f67248aca9270b2dde0a09e4b2cb46e..5482c3e60ae10d88bfe8948a22d23497bcaefe71 100644
--- a/MAC/Deployment/data/bin/load_OTDB_comps.cc
+++ b/MAC/Deployment/data/bin/load_OTDB_comps.cc
@@ -64,7 +64,7 @@ int main (int	argc, char*	argv[]) {
 	} 
 
 	// Open the database connection
-	cout << "### Using database " << dbName << " at " << hostname << " ###" << endl;
+	LOG_INFO_STR("### Using database " << dbName << " at " << hostname << " ###");
 	OTDBconnection conn("paulus", "boskabouter", dbName, hostname);
 
 	try {
diff --git a/MAC/GCF/TM/src/ServiceBroker/Makefile.am b/MAC/GCF/TM/src/ServiceBroker/Makefile.am
index 2dbc350463cfb048a945f4ce96ba0f5c646c88a8..a395e0a74c210b0c59c3f9e7f2fea5f564c128f7 100644
--- a/MAC/GCF/TM/src/ServiceBroker/Makefile.am
+++ b/MAC/GCF/TM/src/ServiceBroker/Makefile.am
@@ -13,7 +13,7 @@ SUFFIXES = .ph
 lib_LTLIBRARIES 			= libeventport.la
 
 libeventport_la_SOURCES		= GSB_Defines.h SB_Protocol.ph EventPort.h \
-							  SB_Protocol.cc EventPort.cc 
+							  SB_Protocol.cc EventPort.cc ../GCF_Event.cc
 
 bin_PROGRAMS		   		= ServiceBroker
   
diff --git a/MAC/GCF/TM/test/Makefile.am b/MAC/GCF/TM/test/Makefile.am
index 5393cb6f7e1e030c791ddd05099adb2aa70af179..1e777408579db2dcd1f21f5c50acc063436f86a8 100644
--- a/MAC/GCF/TM/test/Makefile.am
+++ b/MAC/GCF/TM/test/Makefile.am
@@ -27,8 +27,8 @@ tProtocol_DEPENDENCIES	= ../src/libgcftm.la $(LOFAR_DEPEND)
 
 tEventPort_SOURCES 		= Echo_Protocol.ph Echo_Protocol.cc \
 						  tEventPort.cc
-tEventPort_LDADD		= ../src/ServiceBroker/libeventport.la ../src/libgcftm.la 
-tEventPort_DEPENDENCIES	= ../src/ServiceBroker/libeventport.la $(LOFAR_DEPEND) ../src/libgcftm.la 
+tEventPort_LDADD		= ../src/ServiceBroker/libeventport.la
+tEventPort_DEPENDENCIES	= ../src/ServiceBroker/libeventport.la $(LOFAR_DEPEND)
 
 tTimer_SOURCES 		= $(BUILT_SOURCES) tTimer.cc
 tTimer_LDADD		= ../src/libgcftm.la
diff --git a/SAS/OTDB/sql/instanciateTree_func.sql b/SAS/OTDB/sql/instanciateTree_func.sql
index 6d84f04ef0534d7733cb00a4e97acfb46cd4c732..16fad2bfbd6cf758e7f444ee1a6d45a6fcd3ac28 100644
--- a/SAS/OTDB/sql/instanciateTree_func.sql
+++ b/SAS/OTDB/sql/instanciateTree_func.sql
@@ -234,6 +234,7 @@ CREATE OR REPLACE FUNCTION instanciateVHsubTree(INT4, INT4, INT4, TEXT)
 	  vDummy			VIChierarchy.nodeID%TYPE;
 	  vBasename			VIChierarchy.name%TYPE;
 	  vOwnname			VIChierarchy.name%TYPE;
+	  vSpecialisation	BOOL;
 
 	BEGIN
 --RAISE WARNING \'iVHst(%,%,%,%)\', $1,$2,$3,$4;
@@ -262,10 +263,13 @@ CREATE OR REPLACE FUNCTION instanciateVHsubTree(INT4, INT4, INT4, TEXT)
 		IF NOT FOUND THEN
 		  -- no specialisation, use master node (index=0)
 		  vNodeID := $1;
+		  vSpecialisation := FALSE;
+		ELSE
+		  vSpecialisation := TRUE;
 		END IF;
 
 		-- if there is only 1 instance tell VHleafnode this with index = 0
-		IF vNode.instances = 1 THEN
+		IF vNode.instances = 1 AND vSpecialisation = FALSE THEN
 		  vIndexnr := 0;
 		  vOwnname := vBasename || vNode.name;
 		ELSE