diff --git a/.gitignore b/.gitignore
index 84bb38b87c471d2fc32b915ec9aa2dcaf69bcace..65cde25ee1909e8df97627ea2a42435d56572d61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,7 @@
 CMakeCache.txt
 CMakeFiles
 Makefile
-bin_*
+bin
 cmake_install.cmake
 install_manifest.txt
 ChaosMDSLite/target/*-0.jar
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f5b873e051c914fa373ad539bb361ebb91d6e66c..b058e3d6beae2b6dd99a39d2ee3cb1002a3c6dc3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -109,3 +109,6 @@ ADD_SUBDIRECTORY(example/UIToolkitCMDLineExample bin/bin_example_uicmdline_test)
 
 message(STATUS "Configure UIToolkit c-wrapper command line example")
 ADD_SUBDIRECTORY(example/UIToolkitCMDLineCWrapperExample bin/bin_example_uicmdline_cwrapper_test)
+
+message(STATUS "Configure BenchTest simulation excutable")
+ADD_SUBDIRECTORY(example/BenchTest bin/bench_test)
diff --git a/ChaosMDSLite/.classpath b/ChaosMDSLite/.classpath
index 042eef37cc8a1fe06ec520549d5832a4f3dedde6..495ce355607308bbf226c43742dea2e53c2f999f 100644
--- a/ChaosMDSLite/.classpath
+++ b/ChaosMDSLite/.classpath
@@ -1,11 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
 		<attributes>
 			<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
 		</attributes>
 	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
+		<attributes>
+			<attribute name="owner.project.facets" value="jst.web"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 7 (MacOS X Default)">
+		<attributes>
+			<attribute name="owner.project.facets" value="java"/>
+		</attributes>
+	</classpathentry>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/ChaosMDSLite/.settings/org.eclipse.wst.common.project.facet.core.xml b/ChaosMDSLite/.settings/org.eclipse.wst.common.project.facet.core.xml
index 7ff7048ada961d3ec2d505f2351949fa63a8efc6..efbeb56d4b06b5eab53afe3de8e45964e5331073 100644
--- a/ChaosMDSLite/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/ChaosMDSLite/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <faceted-project>
+  <runtime name="Apache Tomcat v7.0"/>
   <fixed facet="wst.jsdt.web"/>
   <installed facet="java" version="1.5"/>
   <installed facet="wst.jsdt.web" version="1.0"/>
diff --git a/ChaosMDSLite/.settings/org.eclipse.wst.ws.service.policy.prefs b/ChaosMDSLite/.settings/org.eclipse.wst.ws.service.policy.prefs
new file mode 100644
index 0000000000000000000000000000000000000000..9cfcabe16f73da1c14f4a8fa1ee90cd74497f281
--- /dev/null
+++ b/ChaosMDSLite/.settings/org.eclipse.wst.ws.service.policy.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.wst.ws.service.policy.projectEnabled=false
diff --git a/chaos/common/data/CDataWrapper.h b/chaos/common/data/CDataWrapper.h
index 06a80d57bf733ca54b59a441ee4c8008b4118579..1ce8ee628627dc7a8d2bf8dc91bfcdaacd79d6a8 100644
--- a/chaos/common/data/CDataWrapper.h
+++ b/chaos/common/data/CDataWrapper.h
@@ -81,10 +81,10 @@ namespace chaos {
      Class that wrap the serializaiton system for data storage
      */
     class CDataWrapper/*: public CPoolMemoryObject<CDataWrapper> */{
-        scoped_ptr<BSONArrayBuilder> bsonArrayBuilder;
+        auto_ptr<BSONArrayBuilder> bsonArrayBuilder;
         
     protected:
-        scoped_ptr<BSONObjBuilder> bsonBuilder;
+        auto_ptr<BSONObjBuilder> bsonBuilder;
         
     public:
         
diff --git a/chaos/common/dispatcher/DefaultEventDispatcher.cpp b/chaos/common/dispatcher/DefaultEventDispatcher.cpp
index c5515a00e109f29656f3b89fce6a214ffd938ff9..2d22baa2aa000e2acc48aacb5eda0dff326a3161 100644
--- a/chaos/common/dispatcher/DefaultEventDispatcher.cpp
+++ b/chaos/common/dispatcher/DefaultEventDispatcher.cpp
@@ -111,7 +111,6 @@ void DefaultEventDispatcher::deregisterEventAction(EventAction *eventAction)  th
  by dispatcher
  */
 void DefaultEventDispatcher::executeAlertHandler(alert::AlertEventDescriptor *eventDescription)  throw(CException) {
-    EVTDISPAPP_ << "Received and alert event";
     alertEventScheduler->push(eventDescription);
 }
 
@@ -121,7 +120,6 @@ void DefaultEventDispatcher::executeAlertHandler(alert::AlertEventDescriptor *ev
  by dispatcher
  */
 void DefaultEventDispatcher::executeInstrumentHandler(instrument::InstrumentEventDescriptor *eventDescription)  throw(CException) {
-     EVTDISPAPP_ << "Received an instrument event";
     alertEventScheduler->push(eventDescription);
 }
 
@@ -131,7 +129,6 @@ void DefaultEventDispatcher::executeInstrumentHandler(instrument::InstrumentEven
  by dispatcher
  */
 void DefaultEventDispatcher::executeCommandHandler(command::CommandEventDescriptor *eventDescription)  throw(CException) {
-     EVTDISPAPP_ << "executeCommandHandler";
 }
 
     //!Handler execution method
@@ -140,5 +137,5 @@ void DefaultEventDispatcher::executeCommandHandler(command::CommandEventDescript
  by dispatcher
  */
 void DefaultEventDispatcher::executeCustomHandler(custom::CustomEventDescriptor* eventDescription)  throw(CException) {
-     EVTDISPAPP_ << "executeCustomHandler";
+
 }
diff --git a/chaos/common/global.h b/chaos/common/global.h
index e2fdfb499031110994560d00f61f76922f251322..2bb01d5c75c1774a0a392da956d21cb44dabd574 100644
--- a/chaos/common/global.h
+++ b/chaos/common/global.h
@@ -52,7 +52,12 @@ using namespace boost;
 
 
 
-
+enum severity_level
+{
+    normal,
+    error,
+    debug
+};
 
     //src::logger chaosLogger;
 BOOST_LOG_DECLARE_GLOBAL_LOGGER(chaosLogger, boost::log::sources::logger)
diff --git a/chaos/common/log/LogManager.h b/chaos/common/log/LogManager.h
index 3c8af3f2a834169082386591de662487fd44805b..14fd52214fda6d47596d92b4155a6aa888e125bc 100644
--- a/chaos/common/log/LogManager.h
+++ b/chaos/common/log/LogManager.h
@@ -23,11 +23,12 @@
 
 #include <iostream>
 #include <chaos/common/exception/CException.h>
-
+#include <boost/log/sources/severity_logger.hpp>
 namespace chaos {
     class LogManager {
         template<class T>
         friend class ChaosCommon;
+        boost::log::sources::severity_logger< severity_level > slg;
         
         LogManager(){}
     public:
diff --git a/chaos/common/message/DeviceMessageChannel.cpp b/chaos/common/message/DeviceMessageChannel.cpp
index a748c2f8f7f3fa97322b0b54b5e8246ec533ee30..776e22db8d74a553db4693cb5c08b4823be42c78 100644
--- a/chaos/common/message/DeviceMessageChannel.cpp
+++ b/chaos/common/message/DeviceMessageChannel.cpp
@@ -124,7 +124,7 @@ int DeviceMessageChannel::setAttributeValue(CDataWrapper& attributesValues, uint
 }
 
     //------------------------------------
-int DeviceMessageChannel::setScheduleDelay(uint32_t scheduledDealy, uint32_t millisecToWait){
+int DeviceMessageChannel::setScheduleDelay(int32_t scheduledDealy, uint32_t millisecToWait){
     int err = ErrorCode::EC_NO_ERROR;
     CDataWrapper startDeviceParam;
     startDeviceParam.addStringValue(DatasetDefinitionkey::CS_CM_DATASET_DEVICE_ID, deviceNetworkAddress->deviceID);
diff --git a/chaos/common/message/DeviceMessageChannel.h b/chaos/common/message/DeviceMessageChannel.h
index d1705c81cdee1eab5573c87a54f015c82247205a..56b83e21701a07b6635c06e640ffc21c2816a254 100644
--- a/chaos/common/message/DeviceMessageChannel.h
+++ b/chaos/common/message/DeviceMessageChannel.h
@@ -89,7 +89,7 @@ namespace chaos {
         /*!
          Set the delay between a schedule and the next
          */
-        int setScheduleDelay(uint32_t scheduledDealy, uint32_t millisecToWait = 0);
+        int setScheduleDelay(int32_t scheduledDealy, uint32_t millisecToWait = 0);
         
         /*! 
          \brief send a message to a custom action
diff --git a/chaos/common/message/MessageChannel.cpp b/chaos/common/message/MessageChannel.cpp
index 4493347f341ecdee33570d7bc8ae4a986438fb96..264745656922aaea7be187a9a18326dda3f632c5 100644
--- a/chaos/common/message/MessageChannel.cpp
+++ b/chaos/common/message/MessageChannel.cpp
@@ -75,7 +75,6 @@ CDataWrapper *MessageChannel::response(CDataWrapper *responseData, bool& detachD
         
             //lock lk(waith_asnwer_mutex);
         atomic_int_type requestID = responseData->getInt32Value(RpcActionDefinitionKey::CS_CMDM_MESSAGE_ID);
-        LDBG_ << "new requestd id arrived:" << requestID;
             //call the handler
         if(responsIdHandlerMap.count(requestID)>0){
             responsIdHandlerMap[requestID](responseData);
@@ -94,7 +93,6 @@ atomic_int_type MessageChannel::prepareRequestPackAndSend(const char * const nod
     CHAOS_ASSERT(nodeID && actionName && requestPack)
         //get new reqeust id
     atomic_int_type currentRequestID = atomic_increment(&channelRequestIDCounter);
-    LDBG_ << "new requestd id to send:" << currentRequestID;
 
     requestPack->addStringValue(RpcActionDefinitionKey::CS_CMDM_ACTION_DOMAIN, nodeID);
     requestPack->addStringValue(RpcActionDefinitionKey::CS_CMDM_ACTION_NAME, actionName);
diff --git a/chaos/cu_toolkit/ControlManager/AbstractControlUnit.cpp b/chaos/cu_toolkit/ControlManager/AbstractControlUnit.cpp
index 0861da266cf15d5c422b234eddba0ab2bce4e3c2..d0e949ae14d917d22efe5c49fb51bd61c90fbb50 100644
--- a/chaos/cu_toolkit/ControlManager/AbstractControlUnit.cpp
+++ b/chaos/cu_toolkit/ControlManager/AbstractControlUnit.cpp
@@ -523,13 +523,7 @@ CDataWrapper* AbstractControlUnit::_setDatasetAttribute(CDataWrapper *datasetAtt
             //send dataset attribute change pack to control unit implementation
         executionResult = setDatasetAttribute(datasetAttributeValues, detachParam);
         if(attributeHandlerEngineForDeviceIDMap.count(deviceID) > 0) {
-#if DEBUG
-            LAPP_ << "pre attributeHandlerEngineForDeviceIDMap[deviceID]->executeHandler(datasetAttributeValues);";
-#endif
             attributeHandlerEngineForDeviceIDMap[deviceID]->executeHandler(datasetAttributeValues);
-#if DEBUG
-            LAPP_ << "post attributeHandlerEngineForDeviceIDMap[deviceID]->executeHandler(datasetAttributeValues);";
-#endif
         }
             //at this time notify the wel gone setting of comand
         if(deviceEventChannel) deviceEventChannel->notifyForAttributeSetting(deviceID.c_str(), 0);
@@ -579,7 +573,6 @@ CDataWrapper*  AbstractControlUnit::updateConfiguration(CDataWrapper* updatePack
         throw CException(-3, "Device Not Initilized", "AbstractControlUnit::updateConfiguration");
     }
     
-    
         //check to see if the device can ben initialized
     if(keyDataStorageMap.count(deviceID)!=0) {
         keyDataStorageMap[deviceID]->updateConfiguration(updatePack);
@@ -587,7 +580,7 @@ CDataWrapper*  AbstractControlUnit::updateConfiguration(CDataWrapper* updatePack
     
     if(updatePack->hasKey(CUDefinitionKey::CS_CM_THREAD_SCHEDULE_DELAY)){
             //we need to configure the delay  from a run() call and the next
-        int32_t uSecdelay = updatePack->getInt32Value(CUDefinitionKey::CS_CM_THREAD_SCHEDULE_DELAY);
+        int64_t uSecdelay = updatePack->getInt32Value(CUDefinitionKey::CS_CM_THREAD_SCHEDULE_DELAY);
             //check if we need to update the scehdule time
         CThread *taskThread = schedulerDeviceMap[deviceID];
         if(uSecdelay != taskThread->getDelayBeetwenTask()){
diff --git a/chaos/cu_toolkit/ControlManager/DSAttributeHandlerExecutionEngine.cpp b/chaos/cu_toolkit/ControlManager/DSAttributeHandlerExecutionEngine.cpp
index 467669e0de4a351fbc2cd15f59765c8111a9c460..0154b78f9fa37f8a78358c9b949c90947ebbb453 100644
--- a/chaos/cu_toolkit/ControlManager/DSAttributeHandlerExecutionEngine.cpp
+++ b/chaos/cu_toolkit/ControlManager/DSAttributeHandlerExecutionEngine.cpp
@@ -134,71 +134,48 @@ bool DSAttributeHandlerExecutionEngine::executeHandler(CDataWrapper *message) th
         
             //compare the message device id and the local
         if(!_messageDeiveID.compare(deviceID)) {
-            LDSAHEE_ << "the message is for this device->" << deviceID;
             for (std::set<std::string>::iterator iter = managedAttributesName.begin();
                  iter != managedAttributesName.end();
                  iter++) {
                     //execute attribute handler
                 const char * cAttrName = iter->c_str();
-                LDSAHEE_ << "get the type of the attribute " << cAttrName;
 
                 if(message->hasKey(cAttrName)) {
-                    LDSAHEE_ << "The attribute " << cAttrName << " has been found in message";
                         //get attribute info
                     referenceCUSchemeDB->getDeviceAttributeRangeValueInfo(deviceID, *iter, attributeInfo);
-                    
-                    LDSAHEE_ << "The information for attribute " << cAttrName << " has been found";
-                    
                         //call handler
                     switch (attributeInfo.valueType) {
                         case DataType::TYPE_INT32: {
-                            LDSAHEE_ << "get int32 value for " << cAttrName;
                             i32v = message->getInt32Value(cAttrName);
-                            LDSAHEE_ << "The attribute " << cAttrName << " is an int32 =" << i32v;
                             abstractValuePtr = &i32v;
                             break;
                         }
                         case DataType::TYPE_INT64: {
-                            LDSAHEE_ << "get int64 value for " << cAttrName;
                             i64v = message->getInt64Value(cAttrName);
-                            LDSAHEE_ << "The attribute " << cAttrName << " is an int64 =" << i64v;
                             abstractValuePtr = &i64v;
                             break;
                         }
                         case DataType::TYPE_STRING: {
-                            LDSAHEE_ << "get string value for " << cAttrName;
                             sv = message->getStringValue(cAttrName);
-                            LDSAHEE_ << "The attribute " << cAttrName << " is a string =" << sv;
                             abstractValuePtr = &sv;
                             break;
                         }
                         case DataType::TYPE_DOUBLE: {
-                            LDSAHEE_ << "get double value for " << cAttrName;
                             dv = message->getDoubleValue(cAttrName);
-                            LDSAHEE_ << "The attribute " << cAttrName << " is an double =" << dv;
                             abstractValuePtr = &dv;
                             break;
                         }
                         case DataType::TYPE_BYTEARRAY: {
-                            LDSAHEE_ << "get bitearray value for " << cAttrName;
                             binv = message->getBinaryValue(cAttrName, binv_dim);
-                            LDSAHEE_ << "The attribute " << cAttrName << " is a binary";
                             abstractValuePtr = &binv;
                             break;
                         }
                         case DataType::TYPE_STRUCT: {
-                            LDSAHEE_ << "get struct value for " << cAttrName;
                             cdatv = message->getCSDataValue(cAttrName);
-                            LDSAHEE_ << "The attribute " << cAttrName << " is a struct";
                             abstractValuePtr = &cdatv;
                             break;
                         }
                     }
-                    
-                        //call every handler for the current attribute
-
-                    LDSAHEE_ << "Pre call all handler";
-
 
                     std::vector< handler::DSAttributeHandler* > *tmpVector = attrNameHandlerMap[*iter];
                     for (std::vector< handler::DSAttributeHandler* >::iterator iter = tmpVector->begin();
@@ -207,9 +184,6 @@ bool DSAttributeHandlerExecutionEngine::executeHandler(CDataWrapper *message) th
                         handler::DSAttributeHandler *handlerPtr = *iter;
                         handlerPtr->handle(abstractValuePtr);
                     }
-                    LDSAHEE_ << "Post call all handler";
-                } else {
-                    LDSAHEE_ << "The attribute " << cAttrName << " is NOT FOUND in message";
                 }
             }
         }
diff --git a/chaos/ui_toolkit/HighLevelApi/DeviceController.cpp b/chaos/ui_toolkit/HighLevelApi/DeviceController.cpp
index 70072302d39ed49be8bf46b2333021eccdb74a83..41caf355bbdfcd5abe0c572c587a627277df4715 100644
--- a/chaos/ui_toolkit/HighLevelApi/DeviceController.cpp
+++ b/chaos/ui_toolkit/HighLevelApi/DeviceController.cpp
@@ -105,9 +105,9 @@ void DeviceController::updateChannel() throw(CException) {
     }
 }
 
-int DeviceController::setScheduleDelay(int32_t millisecDelay) {
+int DeviceController::setScheduleDelay(int32_t microseconds) {
     CHAOS_ASSERT(deviceChannel)
-    return deviceChannel->setScheduleDelay(millisecDelay, millisecToWait);
+    return deviceChannel->setScheduleDelay(microseconds, millisecToWait);
 }
 
 
diff --git a/chaos/ui_toolkit/HighLevelApi/DeviceController.h b/chaos/ui_toolkit/HighLevelApi/DeviceController.h
index 17f94981f55a2eb236aa31ee950811873d46dcef..685fc4f19ea14780d9682f0dc4701994673f8b8c 100644
--- a/chaos/ui_toolkit/HighLevelApi/DeviceController.h
+++ b/chaos/ui_toolkit/HighLevelApi/DeviceController.h
@@ -142,7 +142,7 @@ namespace chaos {
             /*!
              Set the control unit run method scheduling delay
              */
-            int setScheduleDelay(int32_t millisecDelay);
+            int setScheduleDelay(int32_t microsecondsDelay);
             /*!
              Get attribute name filtered by direction type
              */
diff --git a/example/BenchTest/Batch_Controller.cpp b/example/BenchTest/Batch_Controller.cpp
index d5413274abfb13dcab02d505fda367852f21b25a..b13a339829698ea6be4608f1f534ad94db4b0b08 100644
--- a/example/BenchTest/Batch_Controller.cpp
+++ b/example/BenchTest/Batch_Controller.cpp
@@ -9,25 +9,27 @@
  
  */
 
+#include <string>
 #include "Batch_Controller.h"
 
 
 Batch_Controller::Batch_Controller()
 {
-	for(int i=0;i<Q;i++)
-    {rif[i]=0.0;
-  	    e_precedente[i]=0.0;
-	    u_precedente[i]=0.0;
-    }
-    
-	//scrivi sul MDS come valore di default per il controllo 0;
-    
+
+    memset(rif, 0, Q * sizeof(double));
+    memset(y, 0, Q * sizeof(double));
+    memset(u, 0, P * sizeof(double));
+    memset(e_precedente, 0, Q * sizeof(double));
+    memset(u_precedente, 0, Q * sizeof(double));
+    memset(e_precedente, 0, Q * sizeof(double));
 }
 
+Batch_Controller::~Batch_Controller() {
+    
+}
 
 
-void Batch_Controller::compute_controllo()
-{
+void Batch_Controller::compute_controllo() {
     
 	e[0] = rif[0] - y[0];
 	e[1] = rif[1] - y[1];
diff --git a/example/BenchTest/Batch_Controller.h b/example/BenchTest/Batch_Controller.h
index e9a5137138271a76da28d16357731c0ac5638737..9ab6a218b5e115f25ccec02babbbc13032844e52 100644
--- a/example/BenchTest/Batch_Controller.h
+++ b/example/BenchTest/Batch_Controller.h
@@ -15,17 +15,18 @@ class Batch_Controller {
 	
 	
 	double e[Q]; //variabile ausiliaria per il calcolo del valore del controllo;
-	double rif[Q]; //variabile per impostare un riferimento da far inseguire all'impianto;
 	
 	double e_precedente[Q]; // variabile ausiliaria;
 	double u_precedente[Q]; // vairabile ausiliaria;
-	
+protected:
+    double rif[Q]; //variabile per impostare un riferimento da far inseguire all'impianto;
+
 public:
     double u[P]; //variabile contenente il valore del controllo
 	double y[Q]; //variabile contenente il valore dell'uscita misurata dell'impianto
 
 	Batch_Controller();
-	~Batch_Controller();
+	virtual ~Batch_Controller();
 	
 	void read();
 	void compute_controllo();
diff --git a/example/BenchTest/Batch_Reactor.cpp b/example/BenchTest/Batch_Reactor.cpp
index 6c0a97d25241cf62208243ce6124a05f6da8215a..5d0be05103b693682b4d06c69fd82328c93fd0a7 100644
--- a/example/BenchTest/Batch_Reactor.cpp
+++ b/example/BenchTest/Batch_Reactor.cpp
@@ -17,13 +17,23 @@
 #include <math.h>
 #include "Batch_Reactor.h"
 
+Batch_Reactor::Batch_Reactor() {
+    memset(x, 0, N * sizeof(double));
+    memset(y, 0, Q * sizeof(double));
+    memset(u, 0, P * sizeof(double));
+    memset(y_trasmessa, 0, Q * sizeof(double));
+    memset(perturbation, 0, N * sizeof(double));
+}
 
 void Batch_Reactor::compute_state() {
 	
-	x[0] =  1.0142*x[0]-0.0018*x[1]+0.0651*x[2]-0.0546*x[3]+0.0000*u[0]-0.0010*u[1];
-	x[1] = -0.0057*x[0]+0.9582*x[1]-0.0001*x[2]+0.0067*x[3]+0.0556*u[0]+0.0000*u[1];
-	x[2] =  0.0103*x[0]+0.0417*x[1]+0.9363*x[2]+0.0563*x[3]+0.0125*u[0]-0.0304*u[1];
-	x[3] =  0.0004*x[0]+0.0417*x[1]+0.0129*x[2]+0.9797*x[3]+0.0125*u[0]-0.0002*u[1];
+	x[0] =  1.0142*x[0]-0.0018*x[1]+0.0651*x[2]-0.0546*x[3]+0.0000*u[0]-0.0010*u[1] + perturbation[0];
+	x[1] = -0.0057*x[0]+0.9582*x[1]-0.0001*x[2]+0.0067*x[3]+0.0556*u[0]+0.0000*u[1] + perturbation[1];
+	x[2] =  0.0103*x[0]+0.0417*x[1]+0.9363*x[2]+0.0563*x[3]+0.0125*u[0]-0.0304*u[1] + perturbation[2];
+	x[3] =  0.0004*x[0]+0.0417*x[1]+0.0129*x[2]+0.9797*x[3]+0.0125*u[0]-0.0002*u[1] + perturbation[3];
+    
+    // clean the perturbation if any
+    memset(perturbation, 0, N * sizeof(double));
 }
 
 
@@ -48,4 +58,11 @@ void Batch_Reactor::update_output() {
     }
 }
 
+void Batch_Reactor::perturbateState(double seed) {
+    boost::variate_generator<boost::mt19937, boost::normal_distribution<> > generator(boost::mt19937(time(0)), boost::normal_distribution<>(-seed, seed));
+    for (int idx = 0; idx < N; idx++) {
+        double r = generator();
+        perturbation[0] = r;
+    }
+}
 
diff --git a/example/BenchTest/Batch_Reactor.h b/example/BenchTest/Batch_Reactor.h
index f3ada877877b7decf55374514722833c45af3a21..4feb7372652ffa014cc29b4ba2eb1d87dc3c636b 100644
--- a/example/BenchTest/Batch_Reactor.h
+++ b/example/BenchTest/Batch_Reactor.h
@@ -14,23 +14,28 @@
  */
 #ifndef ChaosFramework_reactor
 #define ChaosFramework_reactor
-
+#include <boost/random.hpp>
 #include <math.h>
 #include "config.h"
 
-class Batch_Reactor {
 
+using namespace boost;
+
+class Batch_Reactor {
+    double error;
 	double y_trasmessa[Q];
-	
+	double perturbation[N]; // initial condition
+    
 	public:
-    double x[N]; //initial condition
-	double y[Q]; //reactor output
+    double x[N]; // initial condition
+	double y[Q]; // reactor output
 	double u[P]; // control value
 	
+    Batch_Reactor();
 	void compute_output();
 	void compute_state(); //non modificare il tempo di campionamente DeltaT!!!
 	void update_output();
-	
+	void perturbateState(double seed);
 };
 #endif
 
diff --git a/example/BenchTest/BenchTest.xcodeproj/project.pbxproj b/example/BenchTest/BenchTest.xcodeproj/project.pbxproj
index 9c846559e753660f38004068f7ee983dd14d2be0..9396f384bbda143c6c4c038daf56d66c34e59bbb 100644
--- a/example/BenchTest/BenchTest.xcodeproj/project.pbxproj
+++ b/example/BenchTest/BenchTest.xcodeproj/project.pbxproj
@@ -13,6 +13,7 @@
 		322F363716A1E9C500731C3F /* Batch_Reactor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 322F363516A1E9C000731C3F /* Batch_Reactor.cpp */; };
 		322F363916A1EA9400731C3F /* Batch_Controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 322F363816A1EA9400731C3F /* Batch_Controller.cpp */; };
 		322F363C16A1EB8B00731C3F /* ReactorController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 322F363A16A1EB8B00731C3F /* ReactorController.cpp */; };
+		32B928B516A2DD32004064E4 /* MainOrkestrator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32B928B116A2D7B8004064E4 /* MainOrkestrator.cpp */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -40,6 +41,8 @@
 		322F363816A1EA9400731C3F /* Batch_Controller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Batch_Controller.cpp; sourceTree = "<group>"; };
 		322F363A16A1EB8B00731C3F /* ReactorController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReactorController.cpp; sourceTree = "<group>"; };
 		322F363B16A1EB8B00731C3F /* ReactorController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReactorController.h; sourceTree = "<group>"; };
+		32B928B116A2D7B8004064E4 /* MainOrkestrator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainOrkestrator.cpp; sourceTree = "<group>"; };
+		32B928B216A2D7B8004064E4 /* MainOrkestrator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainOrkestrator.h; sourceTree = "<group>"; };
 		32BE864A15A0E3C500818C39 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = SOURCE_ROOT; };
 		32F7448F14B49CCB0025638B /* BenchTestReactor */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BenchTestReactor; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
@@ -69,6 +72,8 @@
 				322F363816A1EA9400731C3F /* Batch_Controller.cpp */,
 				322F363B16A1EB8B00731C3F /* ReactorController.h */,
 				322F363A16A1EB8B00731C3F /* ReactorController.cpp */,
+				32B928B216A2D7B8004064E4 /* MainOrkestrator.h */,
+				32B928B116A2D7B8004064E4 /* MainOrkestrator.cpp */,
 				322F362016A1D1F500731C3F /* main_controller.cpp */,
 			);
 			name = src_controller;
@@ -99,8 +104,8 @@
 			children = (
 				322F363016A1DBA600731C3F /* Batch_Reactor.h */,
 				322F363516A1E9C000731C3F /* Batch_Reactor.cpp */,
-				322F360916A1CEE000731C3F /* BenchTestCU.cpp */,
 				322F360A16A1CEE000731C3F /* BenchTestCU.h */,
+				322F360916A1CEE000731C3F /* BenchTestCU.cpp */,
 				322F360B16A1CEE000731C3F /* main_reactor.cpp */,
 			);
 			name = src_reactor;
@@ -178,6 +183,7 @@
 				322F362116A1D1F500731C3F /* main_controller.cpp in Sources */,
 				322F363916A1EA9400731C3F /* Batch_Controller.cpp in Sources */,
 				322F363C16A1EB8B00731C3F /* ReactorController.cpp in Sources */,
+				32B928B516A2DD32004064E4 /* MainOrkestrator.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -428,6 +434,7 @@
 				322F361F16A1D1C200731C3F /* Release */,
 			);
 			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
 		};
 		326027A214B309ED00C906CE /* Build configuration list for PBXProject "BenchTest" */ = {
 			isa = XCConfigurationList;
diff --git a/example/BenchTest/BenchTestCU.cpp b/example/BenchTest/BenchTestCU.cpp
index 932585d28301ca7c5f25b750d550dd8ea4b8e20c..afed066f82bf597007b14e8b9552413161c90236 100644
--- a/example/BenchTest/BenchTestCU.cpp
+++ b/example/BenchTest/BenchTestCU.cpp
@@ -20,6 +20,7 @@
 #include <boost/thread.hpp>
 
 #include "BenchTestCU.h"
+#include "config.h"
 #include <chaos/common/global.h>
 #include <chaos/common/cconstants.h>
 #include <chaos/common/bson/bson.h>
@@ -37,16 +38,12 @@
 using namespace chaos;
 
 
-#define CU_DELAY_FROM_TASKS     20000 //20msec
-
 /*
  Construct a new CU with an identifier
  */
 BenchTestCU::BenchTestCU(std::string& rName, Batch_Reactor *rInstance) {
     reactorName = rName;
     reactorInstance = rInstance;
-    lastInputControl[0] = 0;
-    lastInputControl[1] = 0;
 }
 
 /*
@@ -95,6 +92,12 @@ void BenchTestCU::defineActionAndDataset(CDataWrapper& cuSetup) throw(CException
                                                   "Reactor Output B",
                                                   this,
                                                   &BenchTestCU::setControlB);
+    
+    addInputDoubleAttributeToDataSet<BenchTestCU>(devIDInChar,
+                                                  "pseed",
+                                                  "Pertubastion seed applied to reactor state",
+                                                  this,
+                                                  &BenchTestCU::perturbateState);
 }
 
 /*
@@ -122,9 +125,11 @@ void BenchTestCU::run(const string& deviceID) throw(CException) {
     
     acquiredData->addDoubleValue("output_a", reactorInstance->y[0]);
     acquiredData->addDoubleValue("output_b", reactorInstance->y[1]);
+    LAPP_ << "Output_A=" << reactorInstance->y[0] << " reactor Output_B="<< reactorInstance->y[1];
+    pushDataSetForKey(devIDInChar, acquiredData);
     
     reactorInstance->compute_state();
-    
+
 }
 
 /*
@@ -143,12 +148,19 @@ void BenchTestCU::deinit(const string& deviceID) throw(CException) {
  */
 void BenchTestCU::setControlA(const std::string& deviceID, const double& dValue) {
     boost::unique_lock< boost::shared_mutex > lock(_setControlValueMutext);
-    lastInputControl[0] = dValue;
+    reactorInstance->u[0] = dValue;
 }
 
 /*
  */
 void BenchTestCU::setControlB(const std::string& deviceID, const double& dValue) {
     boost::unique_lock< boost::shared_mutex > lock(_setControlValueMutext);
-    lastInputControl[1] = dValue;
+    reactorInstance->u[1] = dValue;
+}
+
+/*
+ */
+void BenchTestCU::perturbateState(const std::string& deviceID, const double& dValue) {
+    boost::unique_lock< boost::shared_mutex > lock(_setControlValueMutext);
+    reactorInstance->perturbateState(dValue);
 }
\ No newline at end of file
diff --git a/example/BenchTest/BenchTestCU.h b/example/BenchTest/BenchTestCU.h
index 15a6e37fa179df1c524edd32998bad70b39dd114..bde10bc4dfd2e041722b6d4da5e71f463f1ae920 100644
--- a/example/BenchTest/BenchTestCU.h
+++ b/example/BenchTest/BenchTestCU.h
@@ -34,7 +34,6 @@ using namespace boost;
 class BenchTestCU : public AbstractControlUnit {
     string reactorName;
     Batch_Reactor *reactorInstance;
-    double lastInputControl[P];
     boost::shared_mutex _setControlValueMutext;
 public:
 
@@ -49,6 +48,7 @@ public:
 
     inline void setControlA(const std::string& deviceID, const double& dValue);
     inline void setControlB(const std::string& deviceID, const double& dValue);
+    inline void perturbateState(const std::string& deviceID, const double& dValue);
 protected:
     /*
      Define the Control Unit Dataset and Actions
diff --git a/example/BenchTest/CMakeLists.txt b/example/BenchTest/CMakeLists.txt
index 51fcee7e58226c2aa6af1dff93e85bcc8d384b0d..011570c3c5bfcaff0d6001789e590c16ca933cbb 100644
--- a/example/BenchTest/CMakeLists.txt
+++ b/example/BenchTest/CMakeLists.txt
@@ -8,8 +8,14 @@ IF( ($ENV{CHAOS32}) OR (BUILD_FORCE_32) )
     set (CMAKE_LINK_FLAGS "-m32")
 ENDIF()
 
-SET(cutest_exe_src ControlUnitExample.cpp WorkerCU.cpp)
+SET(reactor_device_exe_src main_reactor.cpp Batch_Reactor.cpp BenchTestCU.cpp)
+SET(reactor_controller_exe_src main_controller.cpp Batch_Controller.cpp ReactorController.cpp MainOrkestrator.cpp)
+
 INCLUDE_DIRECTORIES(. ${PROJECT_SOURCE_DIR}/../../usr/local/include /usr/local/include /usr/include) 
 LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/../../usr/local/lib /usr/local/lib)
-ADD_EXECUTABLE(ControlUnitTest ${cutest_exe_src})
-TARGET_LINK_LIBRARIES(ControlUnitTest chaos_cutoolkit chaos_common boost_program_options boost_system boost_thread boost_chrono boost_regex boost_log boost_log_setup memcached msgpack msgpack-rpc mpio) 
+
+ADD_EXECUTABLE(BenchTestReactor ${reactor_device_exe_src})
+ADD_EXECUTABLE(BenchTestController ${reactor_controller_exe_src})
+
+TARGET_LINK_LIBRARIES(BenchTestReactor chaos_cutoolkit chaos_common boost_program_options boost_system boost_thread boost_chrono boost_regex boost_log boost_log_setup memcached msgpack msgpack-rpc mpio) 
+TARGET_LINK_LIBRARIES(BenchTestController chaos_uitoolkit chaos_common boost_program_options boost_system boost_thread boost_chrono boost_regex boost_log boost_log_setup memcached msgpack msgpack-rpc mpio) 
diff --git a/example/BenchTest/MainOrkestrator.cpp b/example/BenchTest/MainOrkestrator.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..98d2e8ea2d435b3b6aea4dd592cc08fc1f6799d2
--- /dev/null
+++ b/example/BenchTest/MainOrkestrator.cpp
@@ -0,0 +1,50 @@
+//
+//  MainOrkestrator.cpp
+//  BenchTest
+//
+//  Created by Claudio Bisegni on 1/13/13.
+//  Copyright (c) 2013 INFN. All rights reserved.
+//
+
+#include "MainOrkestrator.h"
+
+chaos::WaitSemaphore MainOrkestrator::waitCloseSemaphore;
+
+MainOrkestrator::MainOrkestrator(std::vector< std::string > *_reactordeviceIDs, std::vector< double > *_reactorsReferements) {
+    waithUntilEnd = true;
+    reactordeviceIDs = _reactordeviceIDs;
+    reactorsReferements = _reactorsReferements;
+    
+    if (signal((int) SIGINT, MainOrkestrator::signalHanlder) == SIG_ERR){
+        LERR_ << "SIGINT Signal handler registraiton error";
+    }
+    
+    if (signal((int) SIGINT, MainOrkestrator::signalHanlder) == SIG_ERR){
+        LERR_ << "SIGINT Signal handler registraiton error";
+    }
+}
+
+MainOrkestrator::~MainOrkestrator() {
+    
+}
+
+void MainOrkestrator::init() {
+    for(int idx = 0, refIdx = 0; idx < reactordeviceIDs->size(); idx++, refIdx+=Q) {
+        ReactorController *ctrl = new ReactorController((*reactordeviceIDs)[idx], reactorsReferements, refIdx);
+        if(ctrl) ctrl->init();
+        reactorControllerList.add(ctrl);
+    }
+}
+
+void MainOrkestrator::join() {
+    waitCloseSemaphore.wait();
+    
+    //shutdown all controller
+    for(int i=0; i < reactorControllerList.size(); i++) {
+        reactorControllerList[i]->deinit();
+    }
+}
+
+void MainOrkestrator::signalHanlder(int signalNumber) {
+    waitCloseSemaphore.unlock();
+}
diff --git a/example/BenchTest/MainOrkestrator.h b/example/BenchTest/MainOrkestrator.h
new file mode 100644
index 0000000000000000000000000000000000000000..0117e8940b8f5990f53cd052868bb00d2cbff362
--- /dev/null
+++ b/example/BenchTest/MainOrkestrator.h
@@ -0,0 +1,39 @@
+//
+//  MainOrkestrator.h
+//  BenchTest
+//
+//  Created by Claudio Bisegni on 1/13/13.
+//  Copyright (c) 2013 INFN. All rights reserved.
+//
+
+#ifndef __BenchTest__MainOrkestrator__
+#define __BenchTest__MainOrkestrator__
+
+#include <vector>
+#include <string>
+#include <chaos/common/thread/WaitSemaphore.h>
+#include <chaos/common/utility/ArrayPointer.h>
+#include "ReactorController.h"
+
+class MainOrkestrator {
+    bool waithUntilEnd;
+    std::vector< std::string > *reactordeviceIDs;
+    std::vector< double > *reactorsReferements;
+    chaos::ArrayPointer< ReactorController > reactorControllerList;
+    
+    static chaos::WaitSemaphore waitCloseSemaphore;
+    
+
+    static void signalHanlder(int);
+    
+public:
+    typedef boost::mutex::scoped_lock lock;
+ 
+    MainOrkestrator(std::vector< std::string > *_reactordeviceIDs, std::vector< double > *_reactorsReferements);
+    ~MainOrkestrator();
+    void init();
+    void join();
+};
+
+
+#endif /* defined(__BenchTest__MainOrkestrator__) */
diff --git a/example/BenchTest/ReactorController.cpp b/example/BenchTest/ReactorController.cpp
index e7b082c30345f926053ea0129df09f1c884e8dcc..ead59f78b12056806e5ddeeb9a8ddcab0a1db1c9 100644
--- a/example/BenchTest/ReactorController.cpp
+++ b/example/BenchTest/ReactorController.cpp
@@ -6,11 +6,18 @@
 //  Copyright (c) 2013 INFN. All rights reserved.
 //
 
+#include <chaos/common/global.h>
 #include "ReactorController.h"
 
 
-ReactorController::ReactorController(string& _rName):reactorID(_rName) {
+ReactorController::ReactorController(string& _rName, vector<double> *refVec, int refIdx):reactorID(_rName) {
     chaosThread.reset(new chaos::CThread(this));
+    chaosThread->setDelayBeetwenTask(CU_DELAY_FROM_TASKS);
+    
+    //set the referement for this reactor controller
+    for(int idx = 0; idx < Q; idx++) {
+        rif[idx] = (*refVec)[refIdx + idx];
+    }
 }
 
 ReactorController::~ReactorController() {
@@ -18,13 +25,35 @@ ReactorController::~ReactorController() {
 }
 
 void ReactorController::init() {
+    int err = 0;
     state = INIT;
+    
+    CUStateKey::ControlUnitState deviceState;
     chaosReactorController = chaos::ui::HLDataApi::getInstance()->getControllerForDeviceID(reactorID);
+    CHAOS_ASSERT(chaosReactorController)
     
+    //start the reactor
+    err = chaosReactorController->getState(deviceState);
+    if(deviceState != CUStateKey::START) {
+        if(deviceState == CUStateKey::DEINIT) {
+            err = chaosReactorController->initDevice();
+            err = chaosReactorController->startDevice();
+        } else if(deviceState == CUStateKey::STOP) {
+            err = chaosReactorController->startDevice();
+        }
+    }
+    
+    chaosReactorController->setScheduleDelay(CU_DELAY_FROM_TASKS);
+    //start the controller
     chaosThread->start();
 }
 
 void ReactorController::deinit() {
+    int err = 0;
+    if(chaosReactorController) {
+        err = chaosReactorController->stopDevice();
+        err = chaosReactorController->deinitDevice();
+    }
     chaosThread->stop();
     chaosThread->join();
 }
@@ -39,13 +68,23 @@ void ReactorController::joinThread(){
                       
 void ReactorController::executeOnThread(const string&) throw(CException) {
     //state of the reactor
-    int err = ErrorCode::EC_NO_ERROR;
-    CUStateKey::ControlUnitState deviceState;
-    switch(state) {
-        case INIT:
-            err = chaosReactorController->getState(deviceState);
-            break;
-    }
+
+    //execute the control of the reactor
+    
+    chaosReactorController->fetchCurrentDeviceValue();
+    
+    chaos::CDataWrapper *reactorCurrentState = chaosReactorController->getCurrentData();
+    
+    if(!reactorCurrentState) return; // no data found
+    //fill the array 
+    Batch_Controller::y[0] = reactorCurrentState->getDoubleValue("output_a");
+    Batch_Controller::y[1] = reactorCurrentState->getDoubleValue("output_b");
+    
+    Batch_Controller::compute_controllo();
+    
+    LAPP_ << "Control_A=" << Batch_Controller::u[0] << " reactor Control_B="<< Batch_Controller::u[1];
     
+    chaosReactorController->setDoubleAttributeValue("input_a", Batch_Controller::u[0]);
+    chaosReactorController->setDoubleAttributeValue("input_b", Batch_Controller::u[1]);
 }
 
diff --git a/example/BenchTest/ReactorController.h b/example/BenchTest/ReactorController.h
index 76821e26c140187856502d9a9d94fc2cf40502d3..acdfdefef9df72bfc98e48e98cedb327ac1643dc 100644
--- a/example/BenchTest/ReactorController.h
+++ b/example/BenchTest/ReactorController.h
@@ -15,7 +15,7 @@
 #include <chaos/common/thread/ChaosThread.h>
 #include <chaos/ui_toolkit/LowLevelApi/LLRpcApi.h>
 #include <chaos/ui_toolkit/HighLevelApi/HLDataApi.h>
-
+#include "Batch_Controller.h"
 using namespace chaos;
 using namespace std;
 
@@ -25,7 +25,7 @@ typedef enum ControllerState {
     DEINIT
 } ControllerState;
 
-class ReactorController : public chaos::CThreadExecutionTask {
+class ReactorController : public chaos::CThreadExecutionTask, private Batch_Controller{
     string reactorID;
     boost::shared_ptr<CThread> chaosThread;
     chaos::ui::DeviceController *chaosReactorController;
@@ -34,7 +34,7 @@ protected:
     virtual void executeOnThread(const string&) throw(CException);
     
 public:
-    ReactorController(string& _rName);
+    ReactorController(string& _rName, vector<double> *refVec, int refIdx);
     ~ReactorController();
     void init();
     void deinit();
diff --git a/example/BenchTest/config.h b/example/BenchTest/config.h
index 38ee0bd556a87ffa5cba1962d3b92b4e644fffe3..ece8a14fadacec1b1c55916c18d6abf4568d6cdb 100644
--- a/example/BenchTest/config.h
+++ b/example/BenchTest/config.h
@@ -13,7 +13,9 @@ const int N = 4; //Dimensione stato del sistema Reattore;
 const int P = 2; //Numero ingressi di controllo;
 const int Q = 2; //Numero uscite sistema Reattore;
 
-#define REACTOR_NAMES    "reactor_names"
-#define OPT_START_STATE  "state_initial_condition"
+#define REACTOR_NAMES               "reactor_names"
+#define OPT_START_STATE             "state_initial_condition"
+#define REACTOR_REFEREMENT_VALUE    "referement_value"
+#define CU_DELAY_FROM_TASKS         20000 //20msec
 
 #endif
diff --git a/example/BenchTest/main_controller.cpp b/example/BenchTest/main_controller.cpp
index 007df78810b87e7c4f60d59658fd1f6f78ded8a4..f7a92efb3ed9dbdb4981bd257fb84f6cd85c146a 100644
--- a/example/BenchTest/main_controller.cpp
+++ b/example/BenchTest/main_controller.cpp
@@ -69,7 +69,7 @@ using namespace boost::date_time;
 #include <vector>
 #include <string>
 #include "config.h"
-
+#include "MainOrkestrator.h"
 inline ptime utcToLocalPTime(ptime utcPTime){
 	c_local_adjustor<ptime> utcToLocalAdjustor;
 	ptime t11 = utcToLocalAdjustor.utc_to_local(utcPTime);
@@ -79,8 +79,8 @@ inline ptime utcToLocalPTime(ptime utcPTime){
 int main (int argc, char* argv[] )
 {
     try {
-        int64_t reactorsNumber = 1;
         std::vector< std::string > names;
+        std::vector< double > referements;
         string tmpDeviceID("bench_reactor");
         
         //initial state value
@@ -88,9 +88,8 @@ int main (int argc, char* argv[] )
         posix_time::time_duration currentTime;
         
         //! [UIToolkit Attribute Init]
-        ChaosUIToolkit::getInstance()->getGlobalConfigurationInstance()->addOption(REACTOR_NAMES, po::value< std::vector< std::string > >()->multitoken(), "The name (and implicit the number) of the rectors");
-
-
+        ChaosUIToolkit::getInstance()->getGlobalConfigurationInstance()->addOption(REACTOR_NAMES, po::value< std::vector< std::string > >()->multitoken(), "The id (and implicit the number) of the rectors");
+        ChaosUIToolkit::getInstance()->getGlobalConfigurationInstance()->addOption(REACTOR_REFEREMENT_VALUE, po::value< std::vector< double > >()->multitoken(), "The name (and implicit the number) of the rectors");
         //! [UIToolkit Attribute Init]
         
         //! [UIToolkit Init]
@@ -98,14 +97,31 @@ int main (int argc, char* argv[] )
         
         if(ChaosUIToolkit::getInstance()->getGlobalConfigurationInstance()->hasOption(REACTOR_NAMES)){
             names = ChaosUIToolkit::getInstance()->getGlobalConfigurationInstance()->getOption< std::vector< std::string > >(REACTOR_NAMES);
-            reactorsNumber = names.size();
+        } else {
+            names.push_back(tmpDeviceID);
         }
-
         
-        //! [UIToolkit ChannelCreation]
-        CDeviceNetworkAddress deviceNetworkAddress;
-        //! [Datapack sent]
+        if(ChaosUIToolkit::getInstance()->getGlobalConfigurationInstance()->hasOption(REACTOR_REFEREMENT_VALUE)){
+            referements = ChaosUIToolkit::getInstance()->getGlobalConfigurationInstance()->getOption< std::vector< double > >(REACTOR_REFEREMENT_VALUE);
+        } else {
+            for(int idx = 0; idx < Q; idx++) {
+                referements.push_back(1.0);
+            }
+        }
+        
+        if(referements.size() != names.size() * Q) {
+            char error[128];
+            sprintf ( error, "every reactor identified need to have %d referement", Q );
+            throw chaos::CException(0, error, "main");
+        }
+        
+        //! [UIToolkit Init]
         
+        //! [Allocate the main orkestrator]
+        auto_ptr<MainOrkestrator> ork(new MainOrkestrator(&names, &referements));
+        ork->init();
+        ork->join();
+        //! [Allocate the main orkestrator]
         
         //! [UIToolkit Deinit]
         ChaosUIToolkit::getInstance()->deinit();
diff --git a/example/BenchTest/main_reactor.cpp b/example/BenchTest/main_reactor.cpp
index 7cf9f241cb63e18e30979d641645c7a6a0647a68..a0b906a5c88caf284a11e11d2d1873534ba8bdae 100644
--- a/example/BenchTest/main_reactor.cpp
+++ b/example/BenchTest/main_reactor.cpp
@@ -56,60 +56,64 @@ using namespace chaos;
 
 int main (int argc, char* argv[] )
 {
-    int64_t reactorsNumber = 1;
+    int64_t reactorsNumber = 0;
     std::vector< std::string > names;
     string tmpDeviceID("bench_reactor");
     
     //initial state value
     vector<double> stateOption;
-    
-    //! [Custom Option]
-    ChaosCUToolkit::getInstance()->getGlobalConfigurationInstance()->addOption(REACTOR_NAMES, po::value< std::vector< std::string > >()->multitoken(), "The name (and implicit the number) of the rectors");
-    ChaosCUToolkit::getInstance()->getGlobalConfigurationInstance()->addOption(OPT_START_STATE, po::value< std::vector<double> >()->multitoken(), "Initila condition for the Rector internal state");
-    //! [Custom Option]
-    
-    //! [CUTOOLKIT Init]
-    ChaosCUToolkit::getInstance()->init(argc, argv);
-    //! [CUTOOLKIT Init]
-    
-    
-    
-    
-    //! [Adding the CustomControlUnit]
-    if(ChaosCUToolkit::getInstance()->getGlobalConfigurationInstance()->hasOption(REACTOR_NAMES)){
-        names = ChaosCUToolkit::getInstance()->getGlobalConfigurationInstance()->getOption< std::vector< std::string > >(REACTOR_NAMES);
-        reactorsNumber = names.size();
-    }
-    
-    if(ChaosCUToolkit::getInstance()->getGlobalConfigurationInstance()->hasOption(OPT_START_STATE)){
-        stateOption =  ChaosCUToolkit::getInstance()->getGlobalConfigurationInstance()->getOption< std::vector< double > >(OPT_START_STATE);
-    } else {
-        for (int i = 0; i < N; i++) {
-            stateOption[i] = 0.0;
+    try {
+        //! [Custom Option]
+        ChaosCUToolkit::getInstance()->getGlobalConfigurationInstance()->addOption(REACTOR_NAMES, po::value< std::vector< std::string > >()->multitoken(), "The name (and implicit the number) of the rectors");
+        ChaosCUToolkit::getInstance()->getGlobalConfigurationInstance()->addOption(OPT_START_STATE, po::value< std::vector<double> >()->multitoken(), "Initila condition for the Rector internal state");
+        //! [Custom Option]
+        
+        //! [CUTOOLKIT Init]
+        ChaosCUToolkit::getInstance()->init(argc, argv);
+        //! [CUTOOLKIT Init]
+        
+        
+        
+        
+        //! [Adding the CustomControlUnit]
+        if(ChaosCUToolkit::getInstance()->getGlobalConfigurationInstance()->hasOption(REACTOR_NAMES)){
+            names = ChaosCUToolkit::getInstance()->getGlobalConfigurationInstance()->getOption< std::vector< std::string > >(REACTOR_NAMES);
+            reactorsNumber = names.size();
         }
-    }
-    
-    //allocate the reactor isnstance
-    if(reactorsNumber >= 1) {
-        for (int idx1 = 0; idx1 < reactorsNumber; idx1++) {
-            Batch_Reactor *rInstance = new Batch_Reactor();
-            for (int idx2 = 0; idx2 < N; idx2++) {
-                rInstance->x[idx2] = stateOption[idx2];
+        
+        if(ChaosCUToolkit::getInstance()->getGlobalConfigurationInstance()->hasOption(OPT_START_STATE)){
+            stateOption =  ChaosCUToolkit::getInstance()->getGlobalConfigurationInstance()->getOption< std::vector< double > >(OPT_START_STATE);
+        } else {
+            for (int i = 0; i < N; i++) {
+                stateOption.push_back(0.0);
             }
-            ChaosCUToolkit::getInstance()->addControlUnit(new BenchTestCU(names[idx1], rInstance));
         }
-    } else {
-        Batch_Reactor *rInstance = new Batch_Reactor();
-        for (int idx = 0; idx < N; idx++) {
-            rInstance->x[idx] = stateOption[idx];
+        
+        //allocate the reactor isnstance
+        if(reactorsNumber >= 1) {
+            for (int idx1 = 0; idx1 < reactorsNumber; idx1++) {
+                Batch_Reactor *rInstance = new Batch_Reactor();
+                for (int idx2 = 0; idx2 < N; idx2++) {
+                    rInstance->x[idx2] = stateOption[idx2];
+                }
+                ChaosCUToolkit::getInstance()->addControlUnit(new BenchTestCU(names[idx1], rInstance));
+            }
+        } else {
+            Batch_Reactor *rInstance = new Batch_Reactor();
+            for (int idx = 0; idx < N; idx++) {
+                rInstance->x[idx] = stateOption[idx];
+            }
+            ChaosCUToolkit::getInstance()->addControlUnit(new BenchTestCU(tmpDeviceID, rInstance));
         }
-        ChaosCUToolkit::getInstance()->addControlUnit(new BenchTestCU(tmpDeviceID, rInstance));
+        
+        //! [Adding the CustomControlUnit]
+        
+        //! [Starting the Framework]
+        ChaosCUToolkit::getInstance()->start();
+        //! [Starting the Framework]
+    } catch (CException& e) {
+        std::cerr<< e.errorDomain << std::endl;
+        std::cerr<< e.errorMessage << std::endl;
     }
-    
-    //! [Adding the CustomControlUnit]
-    
-    //! [Starting the Framework]
-    ChaosCUToolkit::getInstance()->start();
-    //! [Starting the Framework]
     return 0;
 }
diff --git a/example/ControlUnitTest/ControlUnitTest.xcodeproj/project.pbxproj b/example/ControlUnitTest/ControlUnitTest.xcodeproj/project.pbxproj
index f0c0079049e5ffc4fbb6c4430e5a886b570567c9..5a59063c87ea213d7393965d02a5c0b9da7e8195 100644
--- a/example/ControlUnitTest/ControlUnitTest.xcodeproj/project.pbxproj
+++ b/example/ControlUnitTest/ControlUnitTest.xcodeproj/project.pbxproj
@@ -7,8 +7,6 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		32D078DB159A504D0053BB3A /* libchaos_common.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D078D9159A504D0053BB3A /* libchaos_common.dylib */; };
-		32D078DC159A504D0053BB3A /* libchaos_cutoolkit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 32D078DA159A504D0053BB3A /* libchaos_cutoolkit.dylib */; };
 		32F7449C14B49CFA0025638B /* ControlUnitExample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32F7449914B49CFA0025638B /* ControlUnitExample.cpp */; };
 		32F7449D14B49CFA0025638B /* WorkerCU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32F7449A14B49CFA0025638B /* WorkerCU.cpp */; };
 /* End PBXBuildFile section */
@@ -28,8 +26,6 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				32D078DB159A504D0053BB3A /* libchaos_common.dylib in Frameworks */,
-				32D078DC159A504D0053BB3A /* libchaos_cutoolkit.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -161,10 +157,9 @@
 					/usr/local/include,
 				);
 				LIBRARY_SEARCH_PATHS = (
-					"$(inherited)",
-					"\"$(SRCROOT)/../../DerivedData/CHAOSWorkspace/Build/Products/Debug\"",
+					"$(SRCROOT)/../../DerivedData/CHAOSWorkspace/Build/Products/Debug",
 					/usr/local/lib,
-					"\"$(SRCROOT)/../../usr/local/lib",
+					"$(SRCROOT)/../../usr/local/lib",
 				);
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				ONLY_ACTIVE_ARCH = YES;
@@ -181,6 +176,8 @@
 					"-lmsgpack-rpc",
 					"-lboost_log",
 					"-lboost_log_setup",
+					"-lchaos_cutoolkit",
+					"-lchaos_common",
 				);
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = macosx;
@@ -207,10 +204,9 @@
 					/usr/local/include,
 				);
 				LIBRARY_SEARCH_PATHS = (
-					"$(inherited)",
-					"\"$(SRCROOT)/../../DerivedData/CHAOSWorkspace/Build/Products/Debug\"",
+					"$(SRCROOT)/../../DerivedData/CHAOSWorkspace/Build/Products/Debug",
 					/usr/local/lib,
-					"\"$(SRCROOT)/../../usr/local/lib",
+					"$(SRCROOT)/../../usr/local/lib",
 				);
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				OTHER_LDFLAGS = (
@@ -226,6 +222,8 @@
 					"-lmsgpack-rpc",
 					"-lboost_log",
 					"-lboost_log_setup",
+					"-lchaos_cutoolkit",
+					"-lchaos_common",
 				);
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = macosx;
diff --git a/example/UIToolkitCMDLineCWrapperExample/UIToolkitCMDLineCWrapperExample.xcodeproj/project.pbxproj b/example/UIToolkitCMDLineCWrapperExample/UIToolkitCMDLineCWrapperExample.xcodeproj/project.pbxproj
index 4d6f343f6d87440d345c2dec0d6e48c2f06cd441..f43c8dc2881d9cfd2d0284a51c525493821a5f35 100644
--- a/example/UIToolkitCMDLineCWrapperExample/UIToolkitCMDLineCWrapperExample.xcodeproj/project.pbxproj
+++ b/example/UIToolkitCMDLineCWrapperExample/UIToolkitCMDLineCWrapperExample.xcodeproj/project.pbxproj
@@ -7,7 +7,6 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		324D67DC15DA58A300D60BC0 /* libchaos_uitoolkit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 324D67DB15DA58A300D60BC0 /* libchaos_uitoolkit.dylib */; };
 		324D67E615DA5AE100D60BC0 /* UIToolkitCMDLineCWapperExample.c in Sources */ = {isa = PBXBuildFile; fileRef = 324D67E515DA5AE100D60BC0 /* UIToolkitCMDLineCWapperExample.c */; };
 /* End PBXBuildFile section */
 
@@ -35,7 +34,6 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				324D67DC15DA58A300D60BC0 /* libchaos_uitoolkit.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -191,6 +189,7 @@
 					/usr/local/lib,
 					"$(SRCROOT)/usr/local/lib",
 				);
+				OTHER_LDFLAGS = "-lchaos_uitoolkit";
 				PRODUCT_NAME = UIToolkitCMDLineCWrapperExample;
 			};
 			name = Debug;
@@ -209,6 +208,7 @@
 					/usr/local/lib,
 					"$(SRCROOT)/usr/local/lib",
 				);
+				OTHER_LDFLAGS = "-lchaos_uitoolkit";
 				PRODUCT_NAME = UIToolkitCMDLineCWrapperExample;
 			};
 			name = Release;
diff --git a/example/UIToolkitCMDLineExample/UIToolkitCMDLineExample.xcodeproj/project.pbxproj b/example/UIToolkitCMDLineExample/UIToolkitCMDLineExample.xcodeproj/project.pbxproj
index 33398df1db041a21507947170fea9510030bfed5..a682632f74de912f50db36ccd0cfc0630e503741 100644
--- a/example/UIToolkitCMDLineExample/UIToolkitCMDLineExample.xcodeproj/project.pbxproj
+++ b/example/UIToolkitCMDLineExample/UIToolkitCMDLineExample.xcodeproj/project.pbxproj
@@ -7,8 +7,6 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		328E76B314CEE4F500A3EA95 /* libchaos_common.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 328E76B114CEE4F500A3EA95 /* libchaos_common.dylib */; };
-		328E76B414CEE4F500A3EA95 /* libchaos_uitoolkit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 328E76B214CEE4F500A3EA95 /* libchaos_uitoolkit.dylib */; };
 		328E76B614CEE92D00A3EA95 /* UIToolkitCMDLineExample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 328E76B514CEE92D00A3EA95 /* UIToolkitCMDLineExample.cpp */; };
 /* End PBXBuildFile section */
 
@@ -37,8 +35,6 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				328E76B314CEE4F500A3EA95 /* libchaos_common.dylib in Frameworks */,
-				328E76B414CEE4F500A3EA95 /* libchaos_uitoolkit.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -203,6 +199,8 @@
 					"-lmsgpack-rpc",
 					"-lboost_log",
 					"-lboost_log_setup",
+					"-lchaos_uitoolkit",
+					"-lchaos_common",
 				);
 				PRODUCT_NAME = "$(TARGET_NAME)";
 			};
@@ -236,6 +234,8 @@
 					"-lmsgpack-rpc",
 					"-lboost_log",
 					"-lboost_log_setup",
+					"-lchaos_uitoolkit",
+					"-lchaos_common",
 				);
 				PRODUCT_NAME = "$(TARGET_NAME)";
 			};
diff --git a/test/BSONTestPerf/BSONTestPerf/main.cpp b/test/BSONTestPerf/BSONTestPerf/main.cpp
index 773a2a6b419cae0bc55f82e1c3d1d1339b9b7e73..bee3dfaec3bd5bbee42523d281bbab8a52b6da10 100644
--- a/test/BSONTestPerf/BSONTestPerf/main.cpp
+++ b/test/BSONTestPerf/BSONTestPerf/main.cpp
@@ -45,14 +45,16 @@ int main(int argc, const char * argv[])
     // insert code here...
     timespec prevTS = {0,0};
     timespec ts = {0,0};
-
+    int64_t i64 = 20000;
+    int64_t i64N = 20000;
     current_utc_time(&prevTS);
     
     for (int i = 0; i < 10000; i++) {
         bson::BSONObjBuilder b;
         b.append("name", "Joe");
-        b.append("age", 33);
+        b.append("age", i64);
         bson::BSONObj p = b.obj();
+        i64N = p.getField("age").Long();
     }
     current_utc_time(&ts);
     int d = diff(&prevTS, &ts);