diff --git a/Online/Dataflow/src/Gaucho/DIMMonitoring.h b/Online/Dataflow/src/Gaucho/DIMMonitoring.h
index b9ea8d4c886418a85a6e2318c3365f0b0502b087..112f9a23ce16382ceaca7d5ebd18b3a03cd46f2e 100755
--- a/Online/Dataflow/src/Gaucho/DIMMonitoring.h
+++ b/Online/Dataflow/src/Gaucho/DIMMonitoring.h
@@ -147,9 +147,9 @@ namespace Online   {
     virtual void setRunNo(int runno) override  ;
 
     /// Access to the histogram object map. If not existing NULL is retuned.
-    const ObjMap*        histObjMap()  const;
+    const MonitorObjects* histObjMap()  const;
     /// Access to the counter object map. If not existing NULL is retuned.
-    const ObjMap*        cntrObjMap()  const;
+    const MonitorObjects* cntrObjMap()  const;
 
   private:
 
diff --git a/Online/EventBuilding/CMakeLists.txt b/Online/EventBuilding/CMakeLists.txt
index 92cc7e6c016bf8b668c0d8e9168c0120bf4bd290..75a1d357bdb7d4b6c05b39a4d6fdd73d6c51f136 100644
--- a/Online/EventBuilding/CMakeLists.txt
+++ b/Online/EventBuilding/CMakeLists.txt
@@ -31,6 +31,7 @@ if ( "${PCIE40_DAQ_INC}" STREQUAL "PCIE40_DAQ_INC-NOTFOUND" )
   message(STATUS "+======================================================================+")
   return()
 else()
+  return()
   message(STATUS "+======================================================================+")
   message(STATUS "|   PCIE40 DAQ found.  EventBuilding libraries shall be built.         |")
   message(STATUS "+======================================================================+")
diff --git a/Online/FarmConfig/job/AddersFromArchitecture.py b/Online/FarmConfig/job/AddersFromArchitecture.py
index 245386434303f5a56bfdea06851935a974f53220..7fdf08d530094d8b271e31faf111adb82595b711 100644
--- a/Online/FarmConfig/job/AddersFromArchitecture.py
+++ b/Online/FarmConfig/job/AddersFromArchitecture.py
@@ -99,7 +99,7 @@ class Adder:
     self.obj.ReceiveTimeout  = recv_tmo
     self.obj.IsSaver         = True
     self.obj.SaveInterval    = interval
-    self.obj.SaveonUpdate    = False
+    self.obj.SaveOnUpdate    = False
     self.obj.SaveRootDir     = saveset_dir
     self.obj.SaveSetTaskName = self.task_name
     return self
@@ -214,7 +214,7 @@ def AddersfromTasks(tasklist, adder_type, partition, dohostdns):
       publisher.OutDNS         = MON_TOP_NODE
       publisher.AdderClass     = "counter"
       publisher.ServicePrefix  = "/Stat/<part>/"+task_name;
-      publisher.DebugOn        = True
+      #publisher.DebugOn        = True
       if adder_debug_flag:
         print("%-8s Service pattern: %s Task pattern: %s"\
               %("INFO", publisher.ServicePattern, publisher.TaskPattern, ))
diff --git a/Online/Gaucho/src/components/GaudiHistograms.h b/Online/Gaucho/src/components/GaudiHistograms.h
index dac08b0145f5a89dfe3ceff524b49ae1fa12ff9b..5b0c94b9d6ea8a45ef3361f30b942cec6c25eac1 100644
--- a/Online/Gaucho/src/components/GaudiHistograms.h
+++ b/Online/Gaucho/src/components/GaudiHistograms.h
@@ -84,7 +84,7 @@ namespace Online   {
     }
   }
 
-  template <> int MonHist<Entity>::Serialize(void*&ptr)    {
+  template <> int MonHist<Entity>::serialize(void* ptr)    {
     DimHistbuff1 *pp = (DimHistbuff1*) ptr;
     pp->setup_buffer(*this);
     pp->fetch_labels(this->axes);
@@ -155,7 +155,7 @@ namespace Online   {
   }
 
 #define SerializeMacro							\
-  template <> int MonHist<TYP>::Serialize(void*&ptr)	{		\
+  template <> int MonHist<TYP>::serialize(void* ptr)	{		\
     DimHistbuff1 *pp = (DimHistbuff1*) ptr;				\
     pp->setup_buffer(*this);						\
     pp->fetch_labels(this->axes);					\
diff --git a/Online/Gaucho/src/components/MonCounterAccumulators.tcc.h b/Online/Gaucho/src/components/MonCounterAccumulators.tcc.h
index 6ee958695be30ebaf1cb589c2b4bc346ba55607f..64d0f56a52794ced42222f7e80a7bfde98701c9c 100644
--- a/Online/Gaucho/src/components/MonCounterAccumulators.tcc.h
+++ b/Online/Gaucho/src/components/MonCounterAccumulators.tcc.h
@@ -97,7 +97,7 @@ namespace Online   {
 	  }
       }
       //    int Serialize(void* &ptr) override;
-      int Serialize(void* &ptr) override
+      int serialize(void* ptr) override
       {
 	if ( !SerializeHeader(ptr) ) return 0;
 	unsigned int retval=0;
@@ -230,7 +230,7 @@ namespace Online   {
       {
 	return sizeof(long) + sizeof(double);
       }
-      int Serialize(void* &ptr) override
+      int serialize(void* ptr) override
       {
 	if (!SerializeHeader(ptr))
 	  return 0;
@@ -288,7 +288,7 @@ namespace Online   {
       unsigned int SerialSize()      {
 	return 2 * sizeof(unsigned long);
       }
-      int Serialize(void* &ptr) override      {
+      int serialize(void* ptr) override      {
 	return this->SerializeHeader(ptr) ? this->SerializeData(ptr, m_contents, m_contsiz) : 0;
       }
 
diff --git a/Online/Gaucho/src/components/MonitorSvc.cpp b/Online/Gaucho/src/components/MonitorSvc.cpp
index e2588d0a92ac67e53865f1a84b66ca70cd0e5af1..fd49a0d5f6e742635154214efbeca092770c56a5 100644
--- a/Online/Gaucho/src/components/MonitorSvc.cpp
+++ b/Online/Gaucho/src/components/MonitorSvc.cpp
@@ -134,19 +134,19 @@ StatusCode MonitorSvc::initialize()   {
   }
   m_incidentSvc->addListener(this, "APP_RUNNING");
   m_incidentSvc->addListener(this, "APP_STOPPED");
-  SubSysParams cpars;
+  Online::SubSysParams cpars;
   cpars.ratePrefix   = "R_";
   cpars.dontclear    = m_DontResetCountersonRunChange;
   cpars.expandInfix  = m_expandInfix;
   cpars.expandnames  = m_expandCounterServices;
   cpars.updatePeriod = m_CounterInterval;
-  cpars.type         = MONSUBSYS_Counter;
+  cpars.type         = Online::MONSUBSYS_Counter;
   cpars.runAware     = m_runAware;
-  SubSysParams hpars;
+  Online::SubSysParams hpars;
   hpars.ratePrefix   = "R_";
   hpars.dontclear    = m_DontResetCountersonRunChange;
   hpars.updatePeriod = m_updateInterval;
-  hpars.type         = MONSUBSYS_Histogram;
+  hpars.type         = Online::MONSUBSYS_Histogram;
   hpars.runAware     = m_runAware;
   m_MonIntf.reset(new Online::MonitorInterface(this->m_utgid, move(cpars), move(hpars)));
   m_MonIntf->ApplyCouterClasses(m_CounterClasses);
diff --git a/Online/GauchoAppl/CMakeLists.txt b/Online/GauchoAppl/CMakeLists.txt
index 71615f61b7fbb681eaee11191fb16c4a90bfd225..8a5945fe0fbf0c28e86090d8d5355f82f28e3d8e 100755
--- a/Online/GauchoAppl/CMakeLists.txt
+++ b/Online/GauchoAppl/CMakeLists.txt
@@ -31,7 +31,6 @@ ga_test(taskHistos    test/taskHistos.cpp)
 ga_test(HistHammer    test/HistHammer.cpp)
 ga_test(taskCounters  test/taskCounters.cpp)
 ga_test(Cycler        test/Cycler.cpp)
-ga_test(RateTest      test/RateTest.cpp)
 ga_test(segvtst       test/segvtst.cpp)
 ga_test(ReadCheckTsts test/ReadCheckTsts.cpp)
 ga_test(TypeTst       test/TypeTst.cpp)
diff --git a/Online/GauchoAppl/GauchoAppl/AddSerializer.h b/Online/GauchoAppl/GauchoAppl/AddSerializer.h
index 6ebce04b4b903ab3a7a979d4e4d7c6a4cf660c19..dedf7ede69fe8428d13a9663d52ecc86c5970075 100644
--- a/Online/GauchoAppl/GauchoAppl/AddSerializer.h
+++ b/Online/GauchoAppl/GauchoAppl/AddSerializer.h
@@ -10,54 +10,33 @@
 //
 //==========================================================================
 #pragma once
-#include "Gaucho/ObjSerializer.h"
-#include "Gaucho/dimhist.h"
-#include "Gaucho/Utilities.h"
+#include <Gaucho/Serializer.h>
+#include <Gaucho/mem_buff.h>
 
-#include <cstring>
 #include <map>
 
 /// Online namespace declaration
 namespace Online   {
 
-  class SerHist : public DimHistbuff1   {
-  public:
-    int xmitbuffersize()
-    {
-      return reclen;
-    }
-    void serialize(void *&p)
-    {
-      memcpy(p,this,reclen);
-      p = AddPtr(p,reclen);
-    }
-    void clear()
-    {
-      memset(AddPtr(this,this->dataoff),0,reclen-dataoff);
-    }
-    int namelength()
-    {
-      return namelen-1;
-    }
-    void *cpyName(void *ptr)
-    {
-      strncpy((char*)ptr,(char*)AddPtr(this,nameoff),namelen-1);
-      ptr = (char*)ptr+namelen-1;
-      return ptr;
-    }
+  class DimBuffBase;
 
-  };
+  class AddSerializer : public Serializer    {
+    mem_buff                              buffer;
+    std::map<std::string, DimBuffBase* >& objects;
 
-  class AddSerializer : public ObjSerializer    {
-    void *findhisto(const std::string& name)   const;
+  public:
+    typedef std::map<std::string, DimBuffBase*> MonitorItems;
 
   public:
-    using ObjSerializer::ObjSerializer;
-    void *SerializeObj(void * &ptr,size_t& siz, bool clear=false) override;
-    void *SerializeObj(char *name,void * &ptr,size_t& siz, bool clear=false) override;
-    void *SerializeObj(std::vector<std::string> &nams,void * &ptr,size_t& siz, bool clear=false)    override;
-    void *SerializeDir(void *&ptr, size_t& siz)   override;
-    void DeSerializeObj(char *name,void *&ptr)    override;
-    void DeSerializeObj(std::vector<std::string> &nams,void *&ptr) override;
+    AddSerializer() = delete;
+    AddSerializer(MonitorItems& objects);
+    virtual ~AddSerializer() = default;
+
+    std::pair<size_t,void*> serialize_obj(size_t siz, bool clear=false) override;
+    std::pair<size_t,void*> serialize_obj(const std::string& name,size_t siz, bool clear=false) override;
+    std::pair<size_t,void*> serialize_obj(const std::vector<std::string> &nams, size_t siz, bool clear=false)    override;
+    std::pair<size_t,void*> serialize_dir(size_t siz)   override;
+    virtual std::pair<size_t,const void*> data()   const   override;
+    virtual void updateExpansions()   override;
   };
 }
diff --git a/Online/GauchoAppl/GauchoAppl/AddTimer.h b/Online/GauchoAppl/GauchoAppl/AddTimer.h
index 37fc369787d6e35955b46cad589ef56dee1c63c6..54eced6d12d0fc531357a571fa095ca0b1744cfa 100644
--- a/Online/GauchoAppl/GauchoAppl/AddTimer.h
+++ b/Online/GauchoAppl/GauchoAppl/AddTimer.h
@@ -13,15 +13,13 @@
 #define ONLINE_GAUCHO_ADDTIMER_H
 
 #include "Gaucho/GenTimer.h"
-#include "Gaucho/BRTL_Lock.h"
 
 /// Online namespace declaration
 namespace Online   {
 
   class MonAdder;
 
-  class AddTimer : public GenTimer
-  {
+  class AddTimer : public GenTimer    {
     MonAdder *m_owner;
     bool      m_stopped;
   public:
diff --git a/Online/GauchoAppl/GauchoAppl/AdderSvc.h b/Online/GauchoAppl/GauchoAppl/AdderSvc.h
index 1d676ab53d70c76ca768a53c3ff09b62abcf5b42..9d2de8f70000a89af47b75bb444511b75a5e5e05 100644
--- a/Online/GauchoAppl/GauchoAppl/AdderSvc.h
+++ b/Online/GauchoAppl/GauchoAppl/AdderSvc.h
@@ -17,74 +17,72 @@
 #include <memory>
 
 // Forward declarations
+class DimService;
+class DimServerDns;
+class IIncidentSvc;
+
 namespace Online   {
   class MonAdder;
-  class AdderSys;
   class SaveTimer;
   class MyDimErrorHandler;
 }
 
-class IMonitorSvc;
-class IIncidentSvc;
-class IGauchoMonitorSvc;
-class IHistogramSvc;
-class DimServerDns;
-namespace AIDA { class IHistogram1D; }
-
-
-class AdderSvc : public Service, virtual public IIncidentListener
-{
+class AdderSvc : public Service, virtual public IIncidentListener    {
 public:
   AdderSvc(const std::string& name, ISvcLocator* sl);
-  virtual ~AdderSvc() = default;
-  //IInterface pure member functions
+  virtual ~AdderSvc();
   StatusCode queryInterface(const InterfaceID& riid, void** ppvIF) override;
   StatusCode initialize() override;
   StatusCode start() override;
   StatusCode stop() override;
   StatusCode finalize() override;
-  void gotoPause();
+
   void handle(const Incident&) override;
-  int m_EoRTmoFactor;
-  IMonitorSvc        *m_pMonitorSvc  {nullptr};
-  IHistogramSvc      *m_phistsvc     {nullptr};
-  AIDA::IHistogram1D *m_arrhist      {nullptr};
 
-  Online::SaveTimer  *m_SaveTimer    {nullptr};
-  Online::AdderSys           *m_AdderSys     {nullptr};
-  Online::MonAdder           *m_adder        {nullptr};
-  Online::MonAdder           *m_EoRadder     {nullptr};
-  Online::SaveTimer          *m_EoRSaver     {nullptr};
-  int m_recvtmo;
-  Online::MyDimErrorHandler  *m_errh         {nullptr};
+  void gotoPause();
+
+  StatusCode setup_adder(std::shared_ptr<Online::MonAdder>& adder,
+			 std::shared_ptr<DimServerDns>& dns,
+			 bool is_eor);
+  void setup_saver(std::unique_ptr<Online::SaveTimer>& saver,
+		   std::shared_ptr<Online::MonAdder>& adder,
+		   bool is_eor);
+
   /// Reference to the IncidentSvc instance
-  IIncidentSvc       *m_incidentSvc  {nullptr};
+  SmartIF<IIncidentSvc>       incidentSvc;
+
+  std::shared_ptr<Online::MonAdder>  intervalAdder;
+  std::unique_ptr<Online::SaveTimer> intervalSaver;
+  std::shared_ptr<Online::MonAdder>  eorAdder;
+  std::unique_ptr<Online::SaveTimer> eorSaver;
+  std::shared_ptr<DimService>        savesetSvc;
+  Online::MyDimErrorHandler  *m_errh         {nullptr};
 
-  std::string m_InputDNS;
-  std::string m_OutputDNS;
-  std::string m_SaveRootDir;
-  std::string m_PartitionName;
-  std::string m_SaverTaskName;
-  std::string m_MyName;
-  std::string m_TaskPattern;
-  std::string m_ServicePattern;
-  std::string m_AdderClass;
-  std::shared_ptr<DimServerDns> m_ServiceDns;
-  std::shared_ptr<DimServerDns> m_ClientDns;
-  bool m_standardOutDNS { true };
-  bool m_dohisto;
-  bool m_expandRate;
-  bool m_isSaver;
-//  bool m_isEOR;
-  bool m_started  {false};
-  bool m_doPause;
-  bool m_PauseOnEOR;
-  int  m_SaveInterval; //in seconds
-  bool m_SaveonUpdate  { false };
-  bool m_DebugOn;
-  bool m_Test;
-  bool m_publishFragSize;
-  bool m_RunAware = false;
-  std::string m_MyServiceName;
+  std::string m_inputDNS;
+  std::string m_outputDNS;
+  std::string m_saveRootDir;
+  std::string m_partitionName;
+  std::string m_saverTaskName;
+  std::string m_myName;
+  std::string m_taskPattern;
+  std::string m_servicePattern;
+  std::string m_adderClass;
+  std::string m_myServiceName;
+  std::string m_infoFileStatus;
+  
+  int  m_saveInterval; //in seconds
+  int  m_eorTmoFactor;
+  int  m_recvtmo          { false };
+  bool m_dohisto          { false };
+  bool m_expandRate       { false };
+  bool m_isSaver          { false };
+  bool m_started          { false };
+  bool m_doPause          { false };
+  bool m_pauseOnEOR       { false };
+  bool m_saveOnUpdate     { false };
+  bool m_debugOn          { false };
+  bool m_test             { false };
+  bool m_runAware         { false };
+  bool m_trackSources     { false };
 };
 #endif // ONLINE_GAUCHO_ADDERSVC_H
diff --git a/Online/GauchoAppl/GauchoAppl/AdderSys.h b/Online/GauchoAppl/GauchoAppl/AdderSys.h
index 7988ad3a050ff14d0ba9474293e009b74841b6bb..6b2ba69623678ba07a3db8d4fd8196d31177874e 100644
--- a/Online/GauchoAppl/GauchoAppl/AdderSys.h
+++ b/Online/GauchoAppl/GauchoAppl/AdderSys.h
@@ -50,7 +50,7 @@ namespace Online   {
 
     AdderSys();
     virtual ~AdderSys();
-    static AdderSys &Instance();
+    static AdderSys& instance();
     std::shared_ptr<DimServerDns> getDNS(std::string& dns);
     std::shared_ptr<DimServerDns> getDNS(std::string& dns, std::string& name);
     void add(MonAdder *adder);
@@ -60,6 +60,7 @@ namespace Online   {
     void setDebugOn(bool dbg);
     void addSource(const std::string& src);
     void removeSource(const std::string& src);
+    void trackSources();
   };
 }
 #endif /* ADDERSYS_H_ */
diff --git a/Online/GauchoAppl/GauchoAppl/ClassDescriptor.h b/Online/GauchoAppl/GauchoAppl/ClassDescriptor.h
index 9f715f6d446325f742217e1c76e6806da6a92a0b..412d6ed854e62f3bc396cf837cc452f52a9d783d 100644
--- a/Online/GauchoAppl/GauchoAppl/ClassDescriptor.h
+++ b/Online/GauchoAppl/GauchoAppl/ClassDescriptor.h
@@ -9,58 +9,101 @@
 // Author     : B.Jost
 //
 //==========================================================================
-/*
- * ClassDescriptor.h
- *
- *  Created on: Nov 8, 2019
- *      Author: beat
- */
-
 #ifndef ONLINE_GAUCHOAPPL_GAUCHOAPPL_CLASSDESCRIPTOR_H_
 #define ONLINE_GAUCHOAPPL_GAUCHOAPPL_CLASSDESCRIPTOR_H_
 
+#include <Gaucho/mem_buff.h>
+#include <Gaucho/MonInfo.h>
+#include <dim/dis.hxx>
+
+#include <memory>
+#include <string>
+#include <map>
+
+/// Forward declarations
+class DimServerDns;
+
 
 /// Online namespace declaration
 namespace Online  {
 
-  class ClassDescriptor
-  {
+  class MonInfo;
+  class MonAdder;
+  class ObjService;
+  class TimeoutCmd;
+  class INServiceDescr;
+
+  class INServiceDescr   {
+  public:
+    std::string              task;
+    std::string              service;
+    std::unique_ptr<MonInfo> info;
+    mem_buff                 buffer;
+    long long   last_update        {-1 };
+    size_t      m_fragsize         { 0 };
+    int         m_pid              {-1 };
+    int         m_timeouts         { 0 };
+
+  public:
+  INServiceDescr(const std::string& tsk, const std::string& svc, std::unique_ptr<MonInfo>&& inf) 
+    : task(tsk), service(svc), info(move(inf))
+    {
+    }
+    virtual ~INServiceDescr() = default;
+  };
+
+  class TimeoutCmd : public DimCommand   {
+    MonAdder *adder   { nullptr };
+    std::string service;
   public:
-    ClassDescriptor();
+    TimeoutCmd(DimServerDns *dns, const std::string& nam, const std::string& svc, MonAdder *tis);
+    TimeoutCmd(const std::string& nam, const std::string& svc, MonAdder *tis);
+    void commandHandler() override;
+  };
+
+  class ClassDescriptor : public MonInfoHandler   {
+    typedef std::map<std::string, DimBuffBase*> MonitorItems;
+    typedef std::map<std::string, std::unique_ptr<INServiceDescr> > INServiceMap;
+
+  private:
+    void* allocate(size_t siz);
+    void* reallocate(size_t siz);
+
+  public:
+    ClassDescriptor() = delete;
+    ClassDescriptor(ClassDescriptor&& copy) = delete;
+    ClassDescriptor(const ClassDescriptor& copy) = delete;
+    ClassDescriptor& operator = (ClassDescriptor&& copy) = delete;
+    ClassDescriptor& operator = (const ClassDescriptor& copy) = delete;
+
+    ClassDescriptor(const std::string& name, MonAdder* adder);
     virtual ~ClassDescriptor();
-    bool m_default;
-    std::string m_Name;
-    std::string m_outservname;
-    TskServiceMap m_TaskMap;
-    ObjService    *m_outservice {nullptr};
-    ObjSerializer *m_ser {nullptr};
-    void **m_buffadd    {nullptr};
-    void *m_buffer      {nullptr};
-    size_t m_buffersize {0};
-    size_t m_usedSize   {0};
-    INServiceMap m_inputServicemap;
-    MonMap        m_hmap;
-    size_t m_expected;
-    long long     m_reference;
-    size_t        m_received;
-    int           m_added;
-    bool m_updated;
-    bool m_timeout;
-    long long       m_updateStamp;
-    std::string m_firstSource;
-    unsigned long long m_time0;
-    TimeoutCmd *m_Dimcmd;
+
+    bool  addService(const std::string& task, const std::string& service);
+    void  adoptItems(const void* buffer, size_t length);
+    void  addItem(const std::string& name, DimBuffBase* data);
+    void  enableOutput(std::shared_ptr<DimServerDns>& dns, const std::string& svc, unsigned int run);
+
+    /// Overloaded handler of the MonInfoHandler
+    virtual void operator()(void* data, int size, MonInfo* info)  override;
+
+    std::string                     name;
+    std::string                     firstSource;
+    std::shared_ptr<mem_buff>       buffer;
+    std::unique_ptr<ObjService>     outputservice;
+    std::unique_ptr<TimeoutCmd>     tmo_command;
+    INServiceMap                    inputServices;
+    MonitorItems                    monitorItems;
+    MonAdder*                       adder          { nullptr };
+    long long                       m_updateStamp  { 0 };
+    long long                       m_reference    { 0 };
+    unsigned long long              m_time0        { 0 };
+    size_t                          m_expected     { 0 };
+    size_t                          m_received     { 0 };
+    int                             m_added        { 0 };
+    bool                            m_updated      { 0 };
+    bool                            m_timeout      { 0 };
+    bool                            m_default      { false };
   };
-  class ClassMap : public std::map<std::string,ClassDescriptor*>
-    {
-    public:
-      ClassMap(){};
-      ~ClassMap();
-      ClassDescriptor *FindClass(const std::string &svc)    {
-	std::string cln = getClassName(svc);
-	auto i = find(cln);
-	return (i != end()) ? i->second : 0;
-      }
-    };
 }
 #endif /* ONLINE_GAUCHOAPPL_GAUCHOAPPL_CLASSDESCRIPTOR_H_ */
diff --git a/Online/GauchoAppl/GauchoAppl/CounterAdder.h b/Online/GauchoAppl/GauchoAppl/CounterAdder.h
index bc8d51e8a54dbccae1779683f81f9ab2d9d909e2..e46d1761902de060409d064e9079533bc142397a 100644
--- a/Online/GauchoAppl/GauchoAppl/CounterAdder.h
+++ b/Online/GauchoAppl/GauchoAppl/CounterAdder.h
@@ -17,14 +17,10 @@
 /// Online namespace declaration
 namespace Online  {
 
-  class CounterAdder : public MonAdder
-  {
+  class CounterAdder : public MonAdder  {
   public:
-    void add(void *buffer, int siz, MonInfo *h) override;
-    void addBuffer(void *buffer, int siz, MonInfo *h) override;
-    void Update() override;
-    CounterAdder(const char *myName, const char * serviceName);
-    virtual ~CounterAdder();
+    using MonAdder::MonAdder;
+    virtual void add_item(DimBuffBase* summed, const DimBuffBase* source)  override final;
   };
 }
 #endif //  ONLINE_GAUCHO_COUNTERADDER_H
diff --git a/Online/GauchoAppl/GauchoAppl/HistAdder.h b/Online/GauchoAppl/GauchoAppl/HistAdder.h
index 2d1209b9773f99109b51bd15d45685a45d411d65..b6ddc413670c74a7e02a2c38bfb0b8eb6f1f0bd7 100644
--- a/Online/GauchoAppl/GauchoAppl/HistAdder.h
+++ b/Online/GauchoAppl/GauchoAppl/HistAdder.h
@@ -18,11 +18,8 @@ namespace Online  {
 
   class HistAdder : public MonAdder  {
   public:
-    void add(void *buffer, int siz, MonInfo *h) override;
-    void addBuffer(void *buffer, int siz, MonInfo *h) override;
-    void Update() override;
-    HistAdder(const char* myName, const char* serviceName);
-    virtual ~HistAdder();
+    using MonAdder::MonAdder;
+    virtual void add_item(DimBuffBase* summed, const DimBuffBase* source)  override final;
   };
 }
 #endif
diff --git a/Online/GauchoAppl/GauchoAppl/MonAdder.h b/Online/GauchoAppl/GauchoAppl/MonAdder.h
index 607ac60902b0371344505994bc26ca50c986e370..ba8a5f52728dc5ed2a07ff10a8bd35fb1ce66f15 100644
--- a/Online/GauchoAppl/GauchoAppl/MonAdder.h
+++ b/Online/GauchoAppl/GauchoAppl/MonAdder.h
@@ -13,20 +13,12 @@
 #define ONLINE_GAUCHO_MonAdder_H
 
 #include <Gaucho/MonTypes.h>
-#include <Gaucho/ObjService.h>
 #include <Gaucho/BRTL_Lock.h>
-#include <Gaucho/MonInfo.h>
-#include <Gaucho/Utilities.h>
-#include <GauchoAppl/AddTimer.h>
-#include <GauchoAppl/RunManager.h>
-
-#include <dim/dic.hxx>
-#include <RTL/rtl.h>
-#include <dim/dis.hxx>
+#include <GauchoAppl/ClassDescriptor.h>
 
 #include <map>
-#include <string>
 #include <set>
+#include <string>
 #include <memory>
 #include <vector>
 #include <boost/regex.hpp>
@@ -38,240 +30,152 @@ class IGauchoMonitorSvc;
 class AdderSvc;
 class DimInfo;
 
-namespace AIDA
-{
-  class IHistogram1D;
-}
-
 /// Online namespace declaration
 namespace Online   {
-  class DimBuffBase;
-
-  std::string getClassName(const std::string &service);
-#define offsetinBounds(base,recl,offs) !((AddPtr(base,offs)>AddPtr(base,recl))||(AddPtr(base,offs)<base))
-
-  typedef std::map<std::string, void*> MonMap;
-
-  typedef MonMap::iterator MonIter;
-  class ObjService;
   class HistServer;
   class ObjRPC;
   class MonInfo;
+  class AddTimer;
+  class ObjService;
+  class RunManager;
+  class DimBuffBase;
+  class ClassDescriptor;
 
-  class TaskSvcDescr    {
-  public:
-    std::unique_ptr<DimInfo> diminfo  {};
-    std::string name;
-    std::string m_svcname;
-  TaskSvcDescr(const std::string &nam, DimInfo *i) 
-    : diminfo(i), name(nam)
-    {  }
-  };
-
-  class INServiceDescr   {
-  public:
-    std::string              name;
-    std::unique_ptr<MonInfo> info;
-    std::string task          {   };
-    long long last_update     {-1 };
-    void  *m_buffer           { nullptr };
-    size_t m_bufsiz           { 0 };
-    size_t m_fragsize         { 0 };
-    int m_pid                 {-1 };
-    int m_timeouts            { 0 };
-
-  public:
-  INServiceDescr(const std::string& nam, MonInfo* inf, const std::string& tsk) 
-    : name(nam), info(inf), task(tsk)
-    {
-    }
-    virtual ~INServiceDescr()     {
-      deallocPtr(m_buffer);
-      m_bufsiz =0;
-    }
-    void *CpyBuffer(void *buff, size_t siz)    {
-      m_fragsize = siz;
-      if (m_bufsiz < siz)   {
-	deallocPtr(m_buffer);
-	m_buffer = ::malloc(siz);
-	if (m_buffer != 0)   {
-	  ::memset(m_buffer,0,siz);
-	  m_bufsiz = siz;
-	  ::memcpy(m_buffer,buff,siz);
-	}
-      }
-      else   {
-	::memcpy(m_buffer,buff,siz);
-      }
-      return m_buffer;
-    }
-  };
-
-  typedef std::map<std::string, std::string>     TskServiceMap;
-  typedef std::map<std::string, std::unique_ptr<TaskSvcDescr> >   TaskServiceMap;
-  typedef std::map<std::string, std::unique_ptr<INServiceDescr> > INServiceMap;
-
-  class TaskDescr  {
-  public:
-    INServiceMap servicemap;
-    std::string  name;
-    TaskDescr(const std::string& nam) : name(nam)  {}
-  };
-  typedef std::map<std::string, TaskDescr*> TskMap;
+  template <typename T> inline void add_number(DimBuffBase *sumh, const DimBuffBase *srch)   {
+    T *sum = add_ptr<T>(sumh,sumh->dataoff);
+    const T *src = add_ptr<T>(srch,srch->dataoff);
+    *sum += *src;
+  }
+
+  template <typename T> inline void add_pair(DimBuffBase *sumh, const DimBuffBase *srch)   {
+    T *sum = add_ptr<T>(sumh,sumh->dataoff);
+    const T *src = add_ptr<T>(srch,srch->dataoff);
+    sum[0] += src[0];
+    sum[1] += src[1];
+  }
+
+  template <typename T> inline void add_array(DimBuffBase *sumh, const DimBuffBase *srch)   {
+    int count = (srch->reclen - srch->dataoff)/sizeof(T);
+    T *sum = add_ptr<T>(sumh,sumh->dataoff);
+    const T *src = add_ptr<T>(srch,srch->dataoff);
+    for (int indx = 0; indx < count; indx++ )
+      sum[indx] += src[indx];
+  }
+
+  inline void add_gaudi_average(DimBuffBase *summed_item, const DimBuffBase *source_item)   {
+    long   *suml = add_ptr<long>(summed_item,summed_item->dataoff);
+    double *sumd = add_ptr<double>(suml,sizeof(long));
+    const long   *srcl = add_ptr<long>(source_item,source_item->dataoff);
+    const double *srcd = add_ptr<double>(srcl,sizeof(long));
+    *suml += *srcl;
+    *sumd += *srcd;
+  }
 
   class TimeoutCmd;
-  class ClassDescriptor;
-  class ClassMap;
-
-  class HistEntry  {
-  public:
-  HistEntry(AIDA::IHistogram1D *hh,double val):h(hh),value(val){};
-    AIDA::IHistogram1D *h;
-    double value;
-  };
+  class INServiceDescr;
+  typedef std::map<std::string, DimBuffBase*>                      MonitorItems;
+  typedef std::map<std::string, std::shared_ptr<ClassDescriptor> > ClassMap;
 
   class MonAdder  {
+    friend class TimeoutCmd;
+    friend class ClassDescriptor;
+
   public:
-    std::string    name             { };
-    std::string    cmdName          { };
-    std::string    namePrefix       { };
-    std::string    taskPattern      { };
-    std::string    servicePattern   { };
-    std::string    myServiceName    { };
-    INServiceMap   inputServicemap  { };
-    ClassMap        *classMap       { nullptr };
-    ClassDescriptor *currentClass   { nullptr };
-    IGauchoMonitorSvc  *monSvc      { nullptr };
-    AIDA::IHistogram1D *histo       { nullptr };
-    long long      rectmo           { 0 };
-    bool           expandRate       { false   };
-    bool           isEOR            { false   };
-    bool           test             { false   };
-    bool           noRPC            { false   };
-    bool           dohisto          { false   };
-    bool           disableOutput    { false   };
-    bool           debugOn          { false   };
-    bool           runAware         { false   };
+    typedef std::map<std::string, std::unique_ptr<INServiceDescr> >  INServiceMap;
+    std::string         name             { };
+    std::string         task             { };
+    std::string         cmdName          { };
+    std::string         namePrefix       { };
+    std::string         taskPattern      { };
+    std::string         servicePattern   { };
+
+    std::shared_ptr<DimServerDns>     serviceDNS;
+    INServiceMap        inputServicemap  { };
+    MonitorItems        monitorItems     { };
+    AdderSvc           *parent           { nullptr };
+    long long           rectmo           { 0 };
+    bool                saveOnUpdate     { false   };
+    bool                expandRate       { false   };
+    bool                isEOR            { false   };
+    bool                isSaver          { false   };
+    bool                test             { false   };
+    bool                noRPC            { false   };
+    bool                dohisto          { false   };
+    bool                disableOutput    { false   };
+    bool                debugOn          { false   };
+    bool                runAware         { false   };
+    bool                trackSources     { false   };
+    bool                doPause          { false   };
 
   protected:
-    std::map<long long,std::vector<HistEntry*>*>   histQueue;
-    std::map<std::string, std::set<std::string> >  taskInventory;
+    typedef std::map<std::string, std::set<std::string> > TaskInventory;
+
+    TaskInventory               taskInventory;
+    BRTLLock                    maplock;
+    std::unique_ptr<RunManager> runManager;
+    std::unique_ptr<BRTLLock>   lockid;
+    std::unique_ptr<AddTimer>   timer;
+    std::unique_ptr<ObjRPC>     rpc;
+    std::string                 myName            { };
+    std::string                 serviceName       { };
+    boost::regex                task_regex        { };
+    boost::regex                service_regex     { };
+    DimBuffBase                *rateBuff         { nullptr };
+    void                       *CycleArg                 { nullptr };
+    void                       *PauseArg                 { nullptr };
+    void                      (*CycleFn)(void*, mem_buff&, MonitorItems *, MonAdder *)  { nullptr };
+    void                      (*PauseFn)(void*)         { nullptr };
+    bool                        isLocked         { false   };
+ 
+    int                         type              { 0 };
+    int                         sourceSvc_id { 0 };
+    std::string                 source_buffer;
+    
+    static std::string getClassName(const std::string &service);
+    static void    feedSources(void* tag, void** address, int* size, int* first);
+    static void    load_item_map(MonitorItems& m, mem_buff& buffer);
 
-    AddTimer *m_timer    { nullptr };
-    TskServiceMap m_TaskMap  {  };
-    int  m_type              { 0 };
-    bool m_doPause           { false   };
-    void *CycleCBarg         { nullptr };
-    void *PauseArg           { nullptr };
-    void (*CycleFn)(void*,void*,int, MonMap *, MonAdder *)  { nullptr };
-    void (*PauseFn)(void*) { nullptr };
-    size_t m_FragmentSize             { 0 };
-    std::string m_MyName            { };
-    std::string m_outsvcname        { };
-    std::string m_RPCName           { };
-    TaskServiceMap m_TaskServiceMap { };
+    unsigned long long gettime();
 
-    boost::regex   m_taskexp        { };
-    boost::regex   m_serviceexp     { };
-    MonMap         m_itemmap        { };
-    std::unique_ptr<ObjRPC>        m_rpc;
-    std::unique_ptr<ObjSerializer> m_RPCser;
+    void load_item_map(mem_buff& buffer);
 
-    std::string    m_serviceName    { };
-    bool           m_isSaver        { false   };
-    bool 	   m_SaveonUpdate   { false   };
-    DimBuffBase   *m_RateBuff       { nullptr };
-    bool           m_locked         { false   };
-    AdderSvc      *m_parentAdderSvc { nullptr };
-    RunManager     m_RunManager;
+    void process_buffer(void *buffer, int siz, MonInfo *h);
+    void finish_cycle(std::shared_ptr<ClassDescriptor>& cl, bool force=false);
+    virtual void handleTimeout(std::shared_ptr<ClassDescriptor>& clazz);
+    virtual void AddWhatWeHave();
 
-    std::shared_ptr<DimServerDns> m_ServiceDns;
-    BRTLLock      *m_lockid         { nullptr };
-    BRTLLock       m_maplock;
+  public:
 
-    int            sourceSvc_id { 0 };
-    std::string    source_buffer;
-    static void    feedSources(void* tag, void** address, int* size, int* first);
+    MonAdder(const std::string& task, const std::string& myName, const std::string& svcName, int typ);
+    virtual ~MonAdder();
 
-  public:
+    inline int Lock()    {
+      return this->lockid ? this->lockid->lockMutex() : 0;
+    }
+    inline int UnLock()   {
+      return this->lockid ? this->lockid->unlockMutex() : 0;
+    }
 
     std::string taskName(const std::string& server);
-    DimServerDns* serviceDns()  {  return m_ServiceDns.get();  }
-    void setServiceDns(std::shared_ptr<DimServerDns> dns)  {   m_ServiceDns = std::move(dns); }
+    void SetCycleFn(void CycleCB(void*, mem_buff&, MonitorItems*, MonAdder *), void *tis);
+    void SetPauseFn(void Pause(void*), void *tis);
 
-    virtual void add(void *buffer, int siz, MonInfo *h)=0;
-    virtual void basicAdd(void *buffer, int siz, MonInfo *h);
-    virtual void BasicAdd(void *buffer, int siz, MonInfo *h);
-    virtual void addBuffer(void *buffer, int siz, MonInfo *h)=0;
-
-    MonAdder();
-    virtual ~MonAdder();
-    void *Allocate(size_t siz);
-    void *ReAllocate(size_t new_size);
-    void SetCycleFn(void CycleCB(void*,void*,int, MonMap *, MonAdder *), void *tis){CycleFn = CycleCB; CycleCBarg = tis;  }
-    void SetPauseFn(void Pause(void*),void *tis){PauseFn = Pause;PauseArg=tis;  }
-    void setPause(bool dopause) {m_doPause=dopause;  }
-    void setParent(AdderSvc *parent){m_parentAdderSvc = parent;  }
-    void setSaveonUpdate(bool SaveonUpdate){m_SaveonUpdate = SaveonUpdate;  }
-    INServiceDescr *findINService(const std::string& name);
-    virtual void Configure();
-    virtual void addService(const std::string& task_name, const std::string& svc_name);
-    virtual void removeService(const std::string& task_name, const std::string& svc_name);
-    virtual void synchronizeServices(const std::string& taskname, const std::vector<std::string>&service_list);
+    virtual void configure();
+    virtual void start();
+    virtual void stop();
 
+    std::pair<std::shared_ptr<ClassMap>, unsigned int>
+      get_class_map(const std::string& service, bool create);
+    void addService(const std::string& task_name, const std::string& svc_name);
+    void removeService(const std::string& task_name, const std::string& svc_name);
     void addTask(const std::string& task);
-    virtual void removeTask(const std::string& task);
+    void removeTask(const std::string& task);
+    void update(ClassDescriptor* clazz);
 
-    unsigned long long gettime();
-    virtual void TimeoutHandler();
-    virtual void FillHistos(std::vector<HistEntry*> &hact);
-    virtual void AddWhatWeHave();
-    bool fixRunNumber();
-    void setIsSaver(bool p)    {
-      if (p)	{
-	m_lockid = new BRTLLock();
-	m_lockid->m_name = this->name+"AdderLock";
-      }
-      m_isSaver = p;
-    }
-    int Lock()    {
-      if (m_lockid != 0)   {
-	int status = m_lockid->lockMutex();
-	return status;
-      }
-      return 0;
-    }
-    int UnLock()   {
-      if (m_lockid != 0)   {
-	int status = m_lockid->unlockMutex();
-	return status;
-      }
-      return 0;
-    }
-    int LockMap()    {
-      return m_maplock.lockMutex();
-    }
-    int UnLockMap()    {
-      return m_maplock.unlockMutex();
-    }
-    void dumpServices();
-    void start();
-    void stop();
-    virtual void Update() = 0;
-    virtual void i_update(bool force=false);
-    virtual void I_update(bool force=false);
-  };
-
-  class TimeoutCmd : public DimCommand   {
-    MonAdder *m_adder   { nullptr };
-  public:
-  TimeoutCmd(DimServerDns *dns, const std::string& nam, MonAdder *tis)
-    : DimCommand(dns,nam.c_str(),"I"), m_adder(tis)  {
-    }
-  TimeoutCmd(const std::string& nam, MonAdder *tis)
-    : DimCommand(nam.c_str(),"I"), m_adder(tis)  {
-    }
-    void commandHandler() override;
+    /// Callback to sum up all items of a source frame
+    virtual void add_items(ClassDescriptor* clazz, mem_buff& buffer, MonInfo *info);
+    /// Callback to sum up one single item
+    virtual void add_item(DimBuffBase* summed, const DimBuffBase* source);
   };
 }
 #endif
diff --git a/Online/GauchoAppl/GauchoAppl/RunManager.h b/Online/GauchoAppl/GauchoAppl/RunManager.h
index 5b320d77a1937b09e57563382b0776467c9bd71a..c8945392cdeecbd1279b151387fdf9b9bcb9baeb 100644
--- a/Online/GauchoAppl/GauchoAppl/RunManager.h
+++ b/Online/GauchoAppl/GauchoAppl/RunManager.h
@@ -20,15 +20,22 @@
 #define ONLINE_GAUCHOAPPL_GAUCHOAPPL_RUNMANAGER_H_
 
 #include <map>
-namespace Online  {  class ClassMap;  }
+#include <memory>
 
-class RunManager: public std::map<unsigned int, Online::ClassMap*>  {
+/// Online namespace declaration
+namespace Online  {
+
+  class ClassDescriptor;
+  typedef std::map<std::string, std::shared_ptr<ClassDescriptor> > ClassMap;
+
+  class RunManager : public std::map<unsigned int, std::shared_ptr<Online::ClassMap> >  {
   public:
-    std::size_t m_MaxSize;
+    std::size_t m_MaxSize  { 1 };
     RunManager() = default;
     ~RunManager() = default;
     int cleanOldest();
     void setMaxSize(std::size_t m){ m_MaxSize = m;};
-};
+  };
+}
 
 #endif /* ONLINE_GAUCHOAPPL_GAUCHOAPPL_RUNMANAGER_H_ */
diff --git a/Online/GauchoAppl/GauchoAppl/SaveTimer.h b/Online/GauchoAppl/GauchoAppl/SaveTimer.h
index a48784c09c3914ff6cfb71c8d74d3548be9e5028..d126b1e2665c6edb6162447370f21ff28f7d2483 100644
--- a/Online/GauchoAppl/GauchoAppl/SaveTimer.h
+++ b/Online/GauchoAppl/GauchoAppl/SaveTimer.h
@@ -12,50 +12,43 @@
 #ifndef SAVETIMER_H
 #define SAVETIMER_H
 #include "Gaucho/GenTimer.h"
+#include "Gaucho/mem_buff.h"
 #include "GauchoAppl/MonAdder.h"
-#include "GauchoAppl/HistAdder.h"
 
-class MonSubSys;
+class TFile;
 class DimService;
 class DimServerDns;
-class TFile;
 
 /// Online namespace declaration
 namespace Online   {
 
   class SaveTimer : public GenTimer   {
   public:
-    std::string m_filename;
-    std::string m_rootdir;
-    std::string m_partname;
-    std::string m_taskname;
-    std::string m_currDir;
-    std::string m_currFileName;
-    std::string m_infoFileStatus;
-    std::unique_ptr<TFile>        m_currFile;
-    std::unique_ptr<DimService>   m_filenamesvc;
-    std::pair<size_t, std::unique_ptr<unsigned char[]> > m_buffer;
-    MonAdder *m_adder {nullptr};
-    bool  m_EOR;
-
-  public:
+    std::string rootdir;
+    std::string partition;
+    std::string taskname;
+    std::string currFileName;
+    std::shared_ptr<DimService>   savesetSvc;
+    std::shared_ptr<MonAdder>     adder;
+    mem_buff                      buffer;
+    bool                          EOR   { false };
 
   public:
-    SaveTimer(MonAdder *tis, int period = 900);
-    ~SaveTimer(void);
-    DimService *getSaveSetService(){ return m_filenamesvc.get(); };
-    void setSaveSetService(DimServerDns* dns);
-    void setSaveSetService(DimService *svc){ m_filenamesvc.reset(svc); }
+    SaveTimer(std::shared_ptr<MonAdder>& adder, int period = 900);
+    ~SaveTimer() = default;
+    void setSaveSetService(std::shared_ptr<DimService> svc)  {
+      this->savesetSvc = std::move(svc);
+    }
     void timerHandler() override;
     void stop()  override;
     void savetoFile(const void *buff);
-    void setRootDir(std::string &p){m_rootdir = p;return;};
-    void setPartName(std::string &p){ m_partname= p;return;};
-    void setTaskName(std::string &p){m_taskname = p;return;};
-    void setEOR(bool flg){m_EOR = flg;return;};
+    void setRootDir(const std::string &p)  { this->rootdir = p;    }
+    void setPartName(const std::string &p) { this->partition = p;  }
+    void setTaskName(const std::string &p) { this->taskname = p;   }
+    void setEOR(bool flg)                  { this->EOR = flg;      }
     void makeDirs(int runno);
-    void openFile();
-    void closeFile();
+    std::unique_ptr<TFile> openFile();
+    void closeFile(std::unique_ptr<TFile>& file);
   };
 }
 #endif
diff --git a/Online/GauchoAppl/src/AddSerializer.cpp b/Online/GauchoAppl/src/AddSerializer.cpp
index fe32da0f252e6e88823b82a129b8b452fdcec249..fb9186e7fff0f3e5c9575671e1e64a508320b627 100644
--- a/Online/GauchoAppl/src/AddSerializer.cpp
+++ b/Online/GauchoAppl/src/AddSerializer.cpp
@@ -10,117 +10,91 @@
 //
 //==========================================================================
 #include <GauchoAppl/AddSerializer.h>
+#include <Gaucho/dimhist.h>
+#include <stdexcept>
 #include <cstdlib>
 
 using namespace Online;
 
-void *AddSerializer::SerializeObj(void *&ptr, size_t& siz, bool )   {
-  //std::vector <int>::size_type i;
-  SysIter i;
-  void *pp =0;
+AddSerializer::AddSerializer(MonitorItems& itms) : objects(itms)    {
+}
+
+std::pair<size_t,void*> AddSerializer::serialize_obj(size_t siz, bool )   {
+  void  *pp = nullptr;
   size_t bs = siz;
   printf("AddSerializer: Dump of Object Map\n");
-  for (i =m_objmap->begin();i!=m_objmap->end();i++)
-  {
-    printf("AddSerializer:Histogram %s\n",i->first.c_str());
-    SerHist *h = (SerHist*)i->second;
+  for( const auto& i : this->objects )   {
+    printf("AddSerializer:Histogram %s\n",i.first.c_str());
+    DimBuffBase *h = i.second;
     bs += h->reclen;
-    if (pp>h)
-    {
-      pp=h;
+    if ( pp > h)    {
+      pp = h;
     }
   }
   siz = bs;
-  return ptr;
+  return std::make_pair(0,nullptr);
 }
 
-void *AddSerializer::SerializeObj(std::vector<std::string> &nams,void * &ptr,size_t& siz, bool clear)  {
-  size_t bs = siz;
-  for (unsigned int i=0; i<nams.size(); i++)
-  {
-    SerHist *h = (SerHist*)findhisto(nams[i].c_str());
-    if ( h != nullptr )    {
-      bs += h->reclen;
-    }
+std::pair<size_t,void*> AddSerializer::serialize_obj(const std::vector<std::string> &names, size_t siz, bool clear)  {
+  size_t total_size = siz;
+  std::vector<DimBuffBase*> items;
+  items.reserve(names.size());
+  for (unsigned int i=0; i<names.size(); i++)  {
+    auto o = this->objects.find(names[i]);
+    if ( o != this->objects.end() ) items.emplace_back(o->second);
   }
-  void* pp = ptr = Allocate(bs);
-  pp = AddPtr(pp,siz);
-  siz = bs;
-  for (unsigned int i=0;i<nams.size();i++)
-  {
-    SerHist *h;
-    h = (SerHist *)findhisto(nams[i].c_str());
-    if (h != 0)
-    {
-      h->serialize(pp);
-      if (clear)
-      {
-        h->clear();
-      }
+  for ( const auto* h : items )
+    if ( h ) total_size += h->reclen;
+
+  void* ptr = this->buffer.allocate(total_size);
+  void* obj = add_ptr(ptr, siz);
+  for ( auto* h : items )   {
+    if ( h )    {
+      ::memcpy(obj, h, h->reclen);
+      if (clear) h->clear();
+      obj = add_ptr(obj, h->reclen);
     }
   }
-  return ptr;
+  return std::make_pair(total_size, ptr);
 }
 
-void *AddSerializer::SerializeObj(char *name, void *&ptr, size_t& siz, bool clear)   {
-  void  *pp;
-  size_t bs = siz;
-  SerHist *h = (SerHist*)findhisto(name);
-  if (h == 0)  {
-    ptr = Allocate(siz);
-    return ptr;
-  }
-  bs += h->xmitbuffersize();
-  ptr = Allocate(bs);
-  pp = ptr;
-  pp=AddPtr(pp,siz);
-  siz = bs;
-  h->serialize(pp);
-  if (clear)
-  {
-    h->clear();
+std::pair<size_t,void*> AddSerializer::serialize_obj(const std::string& name, size_t siz, bool clear)   {
+  auto i = this->objects.find(name);
+  if ( i != this->objects.end() )   {
+    DimBuffBase *h = i->second;
+    if ( h != 0 )  {
+      void* ptr = this->buffer.allocate(siz + h->reclen);
+      ::memcpy(add_ptr(ptr, siz), h, h->reclen);
+      if (clear) h->clear();
+      return std::make_pair(siz+h->reclen, ptr);
+    }
   }
-  return ptr;
+  return std::make_pair(siz,this->buffer.allocate(siz));
 }
 
-void *AddSerializer::SerializeDir(void *&ptr, size_t& siz)   {
-  size_t bs = siz;
-  for (auto& i : *m_objmap )  {
-    SerHist *h = (SerHist*)i.second;
-    bs += h->namelength() + 1 + sizeof(int);
+std::pair<size_t,void*> AddSerializer::serialize_dir(size_t siz)   {
+  size_t total_size = siz;
+  for (auto& i : this->objects )  {
+    DimBuffBase *h = i.second;
+    total_size += h ? h->namelen + sizeof(int) : 0;
   }
-  ptr = Allocate(bs);
-  void* pp = ptr;
-  pp = AddPtr(pp,siz);
-  siz = bs;
-  for (auto& i : *m_objmap )  {
-    SerHist *h = (SerHist*)i.second;
-    *(int*)pp = h->type;
-    pp = AddPtr(pp,sizeof(int));
-    pp = h->cpyName(pp);
-    *(char*)pp = 0;
-    pp = AddPtr(pp,1);
+  void*      p = this->buffer.allocate(total_size);
+  DimDirEnt* e = add_ptr<DimDirEnt>(p, siz);
+  for ( auto& i : this->objects )  {
+    DimBuffBase *h = i.second;
+    if ( h )   {
+      e->type = h->type;
+      ::strncpy(e->name,h->name(),h->namelen);
+      e = add_ptr<DimDirEnt>(e,sizeof(e->type)+h->namelen);
+    }
   }
-  return ptr;
-}
-
-void *AddSerializer::findhisto(const std::string& nam)   const  {
-  SysIter i = m_objmap->find(nam);
-  return (i == m_objmap->end()) ? nullptr : i->second;
+  return std::make_pair(total_size, p);
 }
 
-void AddSerializer::DeSerializeObj(char *,void *&)
-{
+std::pair<size_t,const void*> AddSerializer::data()   const    {
+  return std::make_pair(this->buffer.used(), this->buffer.begin());
 }
 
-void AddSerializer::DeSerializeObj(std::vector<std::string> &,void *&)
-{
+void AddSerializer::updateExpansions()     {
 }
 
-
-
-
-
-
-
-
diff --git a/Online/GauchoAppl/src/AddTimer.cpp b/Online/GauchoAppl/src/AddTimer.cpp
index b954452094c9c5cdc44f3309019aaa5c634c9351..165022a284ae745c0ea6b74bfaa472d2fab206a8 100644
--- a/Online/GauchoAppl/src/AddTimer.cpp
+++ b/Online/GauchoAppl/src/AddTimer.cpp
@@ -12,12 +12,9 @@
 #include <GauchoAppl/AddTimer.h>
 #include <GauchoAppl/MonAdder.h>
 
-#include <stdexcept>
-
 using namespace Online;
 
-AddTimer::AddTimer(MonAdder *tis, int period, int typ) : GenTimer((void*)this,period*1000,typ)
-{
+AddTimer::AddTimer(MonAdder *tis, int period, int typ) : GenTimer((void*)this,period*1000,typ)   {
   m_owner = tis;
   m_dueTime = 0;
   this->m_dontdimlock = true;
@@ -25,27 +22,22 @@ AddTimer::AddTimer(MonAdder *tis, int period, int typ) : GenTimer((void*)this,pe
   m_stopped = false;
 }
 
-AddTimer::~AddTimer( )
-{
+AddTimer::~AddTimer()  {
 }
 
-void AddTimer::timerHandler ( void )
-{
+void AddTimer::timerHandler()   {
   int arg = 1;
-  if (!m_stopped)
-  {
+  if (!m_stopped)  {
     DimClient::sendCommandNB(m_owner->cmdName.c_str(),&arg,sizeof(arg));
   }
 }
 
-void AddTimer::startPeriodic(int dt)  
-{
+void AddTimer::startPeriodic(int dt)  {
   m_stopped = false;
   this->GenTimer::startPeriodic(dt);
 }
 
-void AddTimer::stop()
-{
+void AddTimer::stop()   {
   m_stopped = true;
   this->GenTimer::stop();
 }
diff --git a/Online/GauchoAppl/src/AdderSvc.cpp b/Online/GauchoAppl/src/AdderSvc.cpp
index 2a6aedec930077fe5c3cf356342bc68cf4bb1f01..40b87ad9726b40d17eabd4a708b443eabc2c7f4e 100644
--- a/Online/GauchoAppl/src/AdderSvc.cpp
+++ b/Online/GauchoAppl/src/AdderSvc.cpp
@@ -15,63 +15,54 @@
 #include <GauchoAppl/CounterAdder.h>
 #include <GauchoAppl/SaveTimer.h>
 #include <GauchoAppl/AdderSys.h>
-#include <Gaucho/IGauchoMonitorSvc.h>
-#include <Gaucho/SegvHandler.h>
 #include <Gaucho/MyDimErrorHandler.h>
-#include <RTL/strdef.h>
-
-
+#include <Gaucho/SegvHandler.h>
+#include <Gaucho/Utilities.h>
 #include <GaudiKernel/IIncidentSvc.h>
-#include <GaudiKernel/IHistogramSvc.h>
 #include <AIDA/IHistogram.h>
+#include <RTL/strdef.h>
+#include <CPP/Value.h>
 
 using namespace Online;
 
 namespace    {
-  void EORSaver(void *arg, void* /* b */, int /* bsiz */, MonMap* /* m */, MonAdder* /* caller */)
-  {
-//    fprintf(caller->logFile,"Buffer at %p Size %d Buffer End %p\n",b,bsiz,AddPtr(b,bsiz));
-//    fprintf(caller->logFile,"Map Dump at entry of file saving\n");
-//    m->dumpKeys(caller->logFile);
-    SaveTimer *tim = (SaveTimer*) arg;
-    tim->timerHandler();
+  void EORSaver(void *arg, mem_buff& /* b */, MonitorItems* /* m */, MonAdder* /* caller */)  {
+    CPP::_PtrItem<SaveTimer>(arg).ptr()->timerHandler();
   }
-}
-namespace ADDERSVC
-{
-  void doPause(void *arg)
-  {
-    AdderSvc *tis = (AdderSvc*)arg;
-    tis->gotoPause();
+  void doPause(void *arg)    {
+    CPP::_PtrItem<AdderSvc>(arg).ptr()->gotoPause();
   }
 }
 
-AdderSvc::AdderSvc(const std::string& name, ISvcLocator* sl) : Service(name,sl)
-{
+AdderSvc::AdderSvc(const std::string& name, ISvcLocator* sl) : Service(name,sl)   {
   SegvHandler::instance();
-  declareProperty("MyName",          m_MyName          = "");
-  declareProperty("InDNS",           m_InputDNS        = "");
-  declareProperty("OutDNS",          m_OutputDNS       = "<dns>");
-  declareProperty("SaveRootDir",     m_SaveRootDir     = "/home/beat/Hist/Savesets");
+  declareProperty("MyName",          m_myName          = "");
+  declareProperty("InDNS",           m_inputDNS        = "");
+  declareProperty("OutDNS",          m_outputDNS       = "<dns>");
+  declareProperty("SaveRootDir",     m_saveRootDir     = "/home/beat/Hist/Savesets");
   declareProperty("IsSaver",         m_isSaver         = false);
-  declareProperty("SaveInterval",    m_SaveInterval    = 900);
-  declareProperty("PartitionName",   m_PartitionName   = "LHCb");
-  declareProperty("SaveSetTaskName", m_SaverTaskName   = "Moore");
+  declareProperty("SaveInterval",    m_saveInterval    = 900);
+  declareProperty("PartitionName",   m_partitionName   = "LHCb");
+  declareProperty("SaveSetTaskName", m_saverTaskName   = "Moore");
   declareProperty("ExpandRate",      m_expandRate      = false);
   declareProperty("DoHistos",        m_dohisto         = false);
-  declareProperty("AdderClass",      m_AdderClass      = "hists"); //Possible values are 'hists' for histigrams or 'counter' for counters.
-  declareProperty("TaskPattern",     m_TaskPattern);
-  declareProperty("ServicePattern",  m_ServicePattern);
+  declareProperty("AdderClass",      m_adderClass      = "hists"); //Possible values are 'hists' for histigrams or 'counter' for counters.
+  declareProperty("TaskPattern",     m_taskPattern);
+  declareProperty("ServicePattern",  m_servicePattern);
   declareProperty("ReceiveTimeout",  m_recvtmo         = 0);
   declareProperty("GotoPause",       m_doPause         = false);
-  declareProperty("PauseOnEOR",      m_PauseOnEOR      = false);
-  declareProperty("SaveonUpdate",    m_SaveonUpdate    = false);
-  declareProperty("DebugOn",         m_DebugOn         = false);
-  declareProperty("EoRTmoFactor",    m_EoRTmoFactor    = 0);
-  declareProperty("Test",            m_Test            = false);
-  declareProperty("PublishFragSize", m_publishFragSize = false);
-  declareProperty("RunAware",        m_RunAware        = false);
-  m_MyServiceName = name;
+  declareProperty("PauseOnEOR",      m_pauseOnEOR      = false);
+  declareProperty("SaveOnUpdate",    m_saveOnUpdate    = false);
+  declareProperty("DebugOn",         m_debugOn         = false);
+  declareProperty("EoRTmoFactor",    m_eorTmoFactor    = 0);
+  declareProperty("Test",            m_test            = false);
+  declareProperty("RunAware",        m_runAware        = false);
+  declareProperty("TrackSources",    m_trackSources    = false);
+  m_myServiceName = name;
+}
+
+AdderSvc::~AdderSvc()
+{
 }
 
 StatusCode AdderSvc::queryInterface(const InterfaceID& riid, void** ppvIF)  {
@@ -83,77 +74,54 @@ StatusCode AdderSvc::queryInterface(const InterfaceID& riid, void** ppvIF)  {
   return StatusCode::SUCCESS;
 }
 
-StatusCode AdderSvc::initialize()
-{
+StatusCode AdderSvc::initialize()   {
   StatusCode sc = Service::initialize();
   if( !sc.isSuccess() )  {
     return sc;
   }
-  if ( m_TaskPattern.empty() )  {
+  if ( m_taskPattern.empty() )  {
     ::lib_rtl_output(LIB_RTL_FATAL,"+++ The option \"TaskPattern\" MUST be set!");
     return StatusCode::FAILURE;
   }
-  else if ( m_ServicePattern.empty() )  {
+  else if ( m_servicePattern.empty() )  {
     ::lib_rtl_output(LIB_RTL_FATAL,"+++ The option \"ServicePattern\" MUST be set!");
     return StatusCode::FAILURE;
   }
-  else if( m_dohisto )  {
-    sc = serviceLocator()->service("MonitorSvc", m_pMonitorSvc, true);
-    if( !sc.isSuccess() )    {
-      ::lib_rtl_output(LIB_RTL_FATAL,"+++ Unable to locate the IGauchoMonitorSvc interface.");
-      return StatusCode::FAILURE;
-    }
-    ::lib_rtl_output(LIB_RTL_DEBUG,"+++ Found the IMonitorSvc interface");
-    sc = serviceLocator()->service("HistogramDataSvc",m_phistsvc,true);
-    if( !sc.isSuccess() )    {
-      ::lib_rtl_output(LIB_RTL_FATAL,"+++ Unable to locate the Histogram Data Service interface.");
-      return StatusCode::FAILURE;
-    }
-    ::lib_rtl_output(LIB_RTL_DEBUG,"+++ Found the Histogram Data Service interface");
-  }
-  m_adder = 0;
-  m_EoRadder = 0;
-  m_SaveTimer = 0;
-  sc = serviceLocator()->service("IncidentSvc",m_incidentSvc,true);
-  if( !sc.isSuccess() ) {
-    return sc;
-  }
-  m_incidentSvc->addListener(this,"APP_INITIALIZED");
-  m_incidentSvc->addListener(this,"APP_RUNNING");
-  m_incidentSvc->addListener(this,"APP_STOPPED");
-  // Book arrival time histograms
-  if (m_dohisto)  {
-    m_arrhist = m_phistsvc->book(name()+"/arrivaltime","Adder Packet Arrival Time in seconds",100,0.0,50.0);
-    m_pMonitorSvc->declareInfo("ArrivalTimes", m_arrhist, "", this);
+  this->incidentSvc = serviceLocator()->service("IncidentSvc",true);
+  if( !this->incidentSvc.get() ) {
+    return StatusCode::FAILURE;
   }
+  this->incidentSvc->addListener(this,"APP_INITIALIZED");
+  this->incidentSvc->addListener(this,"APP_RUNNING");
+  this->incidentSvc->addListener(this,"APP_STOPPED");
   return StatusCode::SUCCESS;
 }
 
 StatusCode AdderSvc::start()   {
   std::string servicename;
-  std::string myservicename;
-  std::string nodename = RTL::nodeNameShort();
+  std::string nodename = RTL::str_lower(RTL::nodeNameShort());
+  auto& sys = AdderSys::instance();
+  sys.setDebugOn(m_debugOn);
+  MonInfo::setShutdownInProgress(false);
 
   StatusCode status = Service::start();
-  if ( !status.isSuccess() )  {}
-  if (m_errh == 0) m_errh = new MyDimErrorHandler();
-  m_TaskPattern    = RTL::str_lower(m_TaskPattern);
-  m_ServicePattern = (m_ServicePattern);
-  nodename         = RTL::str_lower(nodename);
-  m_AdderClass     = RTL::str_lower(m_AdderClass);
-  m_InputDNS       = RTL::str_lower(m_InputDNS);
-  m_OutputDNS      = RTL::str_lower(m_OutputDNS);
-  if (m_AdderClass == "hists")
-  {
+  if ( !status.isSuccess() )  {
+    return status;
+  }
+  if (m_errh == 0)   {
+    m_errh = new MyDimErrorHandler();
+  }
+
+  m_taskPattern    = RTL::str_lower(m_taskPattern);
+  m_adderClass     = RTL::str_lower(m_adderClass);
+  m_inputDNS       = RTL::str_lower(m_inputDNS);
+  m_outputDNS      = RTL::str_lower(m_outputDNS);
+  if (m_adderClass == "hists")   {
     servicename = "Histos";
   }
-  else if(m_AdderClass == "counter")
-  {
+  else if(m_adderClass == "counter")   {
     servicename = "Counter";
   }
-  m_AdderSys = &AdderSys::Instance();
-  m_AdderSys->setDebugOn(m_DebugOn);
-  MonInfo::setShutdownInProgress(false);
 // Nodeadders:
 // Source task names:
 //  Reconstruction task structure: <Partition>_<Node>_RecBrunel_xx
@@ -169,227 +137,156 @@ StatusCode AdderSvc::start()   {
 //   Reconstruction: <part>_<node>_RecAdder_xx
 //   HLT: <sfnname>_Adder_xx     sfname = hltxyy
 //
-  StringReplace(m_SaveRootDir, "<node>", nodename);
-  StringReplace(m_SaveRootDir, "<part>", m_PartitionName);
+  m_saveRootDir = RTL::str_replace(m_saveRootDir, "<node>", nodename);
+  m_saveRootDir = RTL::str_replace(m_saveRootDir, "<part>", m_partitionName);
 
-  StringReplace(m_TaskPattern, "<node>", nodename);
-  StringReplace(m_TaskPattern, "<part>", m_PartitionName);
-  m_TaskPattern += "(.*)";
+  m_taskPattern = RTL::str_replace(m_taskPattern, "<node>", nodename);
+  m_taskPattern = RTL::str_replace(m_taskPattern, "<part>", m_partitionName);
+  m_taskPattern += "(.*)";
 
-  StringReplace(m_ServicePattern, "<node>", nodename);
-  StringReplace(m_ServicePattern, "<part>", m_PartitionName);
-  myservicename = m_MyName;
-  StringReplace(myservicename, "<part>", m_PartitionName);
-  StringReplace(myservicename, "<node>", nodename);
-  const char *dnsnode = getenv("DIM_DNS_NODE");
-  std::string ddns = RTL::str_lower(dnsnode ? dnsnode : "");
-  StringReplace(m_InputDNS,"<node>",nodename);
-  StringReplace(m_InputDNS,"<dns>",ddns);
-  if (m_OutputDNS.length() != 0)  {
-    StringReplace(m_OutputDNS,"<node>",nodename);
-    StringReplace(m_OutputDNS,"<dns>",ddns);
+  m_servicePattern = RTL::str_replace(m_servicePattern, "<node>", nodename);
+  m_servicePattern = RTL::str_replace(m_servicePattern, "<part>", m_partitionName);
+  std::string ddns = RTL::str_lower(getenv("DIM_DNS_NODE") ? getenv("DIM_DNS_NODE") : "");
+  m_inputDNS = RTL::str_replace(m_inputDNS,"<node>",nodename);
+  m_inputDNS = RTL::str_replace(m_inputDNS,"<dns>",ddns);
+  if ( m_outputDNS.empty() )  {
+    m_outputDNS = ddns;
   }
   else  {
-    m_OutputDNS = ddns;
-  }
-  if (m_OutputDNS != ddns)  {
-    m_standardOutDNS = false;
-    m_ServiceDns = this->m_AdderSys->getDNS(m_OutputDNS);
-    m_standardOutDNS = false;
+    m_outputDNS = RTL::str_replace(m_outputDNS,"<node>",nodename);
+    m_outputDNS = RTL::str_replace(m_outputDNS,"<dns>",ddns);
   }
+  if ( m_trackSources ) sys.trackSources();
+  std::shared_ptr<DimServerDns> service_dns = sys.getDNS(m_outputDNS);
   m_errh->start();
   if (m_started) return StatusCode::SUCCESS;
   if (m_errh != 0) DimClient::addErrorHandler(m_errh);
   if (m_errh != 0) DimServer::addErrorHandler(m_errh);
   ::lib_rtl_output(LIB_RTL_INFO,"AdderSvc Pattern: Task: %s Service: %s + Data/EOR",
-		   m_TaskPattern.c_str(), m_ServicePattern.c_str());
-  //DimServer::autoStartOn();
-  if (!m_InputDNS.empty()) DimClient::setDnsNode(m_InputDNS.c_str());
+		   m_taskPattern.c_str(), m_servicePattern.c_str());
+  if (!m_inputDNS.empty()) DimClient::setDnsNode(m_inputDNS.c_str());
 
-  if (m_AdderClass == "hists")   {
-    m_adder = new HistAdder(myservicename.c_str(), "Data");
-  }
-  else if (m_AdderClass == "counter")   {
-    m_adder = new CounterAdder(myservicename.c_str(), "Data");
-  }
-  else   {
-    ::lib_rtl_output(LIB_RTL_FATAL,"+++ Invalid adder class specified: '%s'", m_AdderClass.c_str());
+  m_infoFileStatus = "SAVESETLOCATION/......................................................";
+  std::string infoName = m_partitionName+"/"+m_saverTaskName+"/SAVESETLOCATION";
+  this->savesetSvc.reset(new DimService(service_dns.get(), infoName.c_str(),(char*)m_infoFileStatus.c_str()));
+
+  if ( !this->setup_adder(this->intervalAdder, service_dns, false).isSuccess() )   {
+    ::lib_rtl_output(LIB_RTL_FATAL,"+++ Failed to configure adder....");
     return StatusCode::FAILURE;
   }
-  m_adder->debugOn = m_DebugOn;
-  m_adder->test    = m_Test;
-  m_adder->setParent(this);
-  m_adder->setPause(m_doPause);
-  if (m_doPause)
-  {
-    m_adder->SetPauseFn(ADDERSVC::doPause,this);
-  }
-  m_adder->isEOR = false;
-  m_adder->expandRate = m_expandRate;
-  if (m_expandRate)
-  {
-    m_adder->namePrefix = m_PartitionName+"_";
+  if ( m_isSaver )  {
+    this->setup_saver(this->intervalSaver, this->intervalAdder, false);
+    this->intervalSaver->start();
   }
-  m_adder->runAware = m_RunAware;
-  if (m_RunAware)
-  {
-    m_adder->servicePattern = m_ServicePattern+"[[:digit:]]*/Data(.*)";
-  }
-  else
-  {
-    m_adder->servicePattern = m_ServicePattern+std::string("Data(.*)");
-  }
-  m_adder->taskPattern = m_TaskPattern;
-  m_adder->servicePattern = m_ServicePattern+std::string("Data(.*)");
-  m_adder->dohisto = m_dohisto;
-  m_adder->histo = m_arrhist;
-  m_adder->rectmo = m_recvtmo;
-  if (m_dohisto)
-  {
-    m_adder->monSvc = dynamic_cast<IGauchoMonitorSvc*>(m_pMonitorSvc);
-  }
-  m_adder->myServiceName = m_MyServiceName;
-  m_adder->setSaveonUpdate(m_SaveonUpdate);
-  if (!m_standardOutDNS)
-  {
-    m_adder->setServiceDns(m_ServiceDns);
+
+  if ( !this->setup_adder(this->eorAdder, service_dns, true).isSuccess() )   {
+    ::lib_rtl_output(LIB_RTL_FATAL,"+++ Failed to configure adder....");
+    return StatusCode::FAILURE;
   }
-  m_adder->Configure();
-  m_adder->setIsSaver(m_isSaver);
-  m_AdderSys->add(m_adder);
-  if (m_isSaver)
-  {
-    m_SaveTimer = new SaveTimer(m_adder,m_SaveInterval);
-    m_SaveTimer->setPartName(m_PartitionName);
-    m_SaveTimer->setRootDir(m_SaveRootDir);
-    m_SaveTimer->setTaskName(m_SaverTaskName);
-    m_SaveTimer->setEOR(false);
-    m_SaveTimer->setSaveSetService(m_adder->serviceDns());
-    m_SaveTimer->start();
+  if ( m_isSaver )  {  
+    this->setup_saver(this->eorSaver, this->eorAdder, true);
+    if ( !m_saveOnUpdate )    {
+      this->eorAdder->SetCycleFn(EORSaver, this->eorSaver.get());
+    }
   }
+  m_started = true;
+  return StatusCode::SUCCESS;
+}
 
-  if ( m_AdderClass == "hists" )  {
-    m_EoRadder = new HistAdder(myservicename.c_str(), "EOR");
-  }
-  else if ( m_AdderClass == "counter" )  {
-    m_EoRadder = new CounterAdder(myservicename.c_str(), "EOR");
+void AdderSvc::setup_saver(std::unique_ptr<Online::SaveTimer>& saver, 
+			   std::shared_ptr<Online::MonAdder>&  adder, bool is_eor)   {
+  saver = std::make_unique<SaveTimer>(adder, this->m_saveInterval);
+  saver->setSaveSetService(this->savesetSvc);
+  saver->setPartName(m_partitionName);
+  saver->setRootDir(m_saveRootDir);
+  saver->setTaskName(m_saverTaskName);
+  saver->setEOR(is_eor);
+}
+
+StatusCode AdderSvc::setup_adder(std::shared_ptr<MonAdder>& adder,
+				 std::shared_ptr<DimServerDns>& dns, bool is_eor)   {
+  std::string nodename = RTL::str_lower(RTL::nodeNameShort());
+  std::string myservicename = m_myName;
+  myservicename = RTL::str_replace(myservicename, "<part>", m_partitionName);
+  myservicename = RTL::str_replace(myservicename, "<node>", nodename);
+  if ( m_adderClass == "hists" )  {
+    adder = std::make_shared<HistAdder>(this->name(), myservicename, is_eor ? "EOR" : "Data", ADD_HISTO);
+  }
+  else if ( m_adderClass == "counter" )  {
+    adder = std::make_shared<CounterAdder>(this->name(), myservicename, is_eor ? "EOR" : "Data", ADD_COUNTER);
   }
-  m_EoRadder->test = m_Test;
-  m_EoRadder->debugOn = m_DebugOn;
-  m_EoRadder->setParent(this);
-  m_EoRadder->setPause(m_PauseOnEOR);
-  if (m_PauseOnEOR)  {
-    m_EoRadder->SetPauseFn(ADDERSVC::doPause,this);
+  else   {
+    ::lib_rtl_output(LIB_RTL_FATAL,"+++ Invalid adder class specified: '%s'", m_adderClass.c_str());
+    return StatusCode::FAILURE;
   }
-  m_EoRadder->isEOR = true;
-  m_EoRadder->expandRate = false;
-  m_EoRadder->taskPattern = m_TaskPattern;
-  m_EoRadder->servicePattern = m_ServicePattern+std::string("EOR(.*)");
-  m_EoRadder->noRPC = true;
-  if (m_EoRTmoFactor == 0)  {
-    m_EoRadder->rectmo = 500*m_recvtmo;
+  adder->parent       = this;
+  adder->test         = m_test;
+  adder->debugOn      = m_debugOn;
+  adder->taskPattern  = m_taskPattern;
+  adder->serviceDNS   = dns;
+  adder->isSaver      = m_isSaver;
+  adder->saveOnUpdate = m_saveOnUpdate;
+  adder->trackSources = m_trackSources;
+  adder->isEOR        = is_eor;
+  adder->noRPC        = is_eor;
+  adder->expandRate   = is_eor ? false : m_expandRate;
+  adder->doPause      = is_eor ? m_pauseOnEOR : m_doPause;
+
+  if ( !is_eor ) {
+    if ( m_doPause ) adder->SetPauseFn(::doPause, this);
+    adder->namePrefix     = m_partitionName+"_";
+    adder->runAware       = m_runAware;
+    this->intervalAdder->servicePattern = m_servicePattern + 
+      (m_runAware ? "[[:digit:]]*/Data(.*)" : "Data(.*)");
+    adder->rectmo         = m_recvtmo;
   }
   else  {
-    m_EoRadder->rectmo = m_EoRTmoFactor;
-  }
-  m_EoRadder->myServiceName = m_MyServiceName;
-  if (!m_standardOutDNS)  {
-    m_EoRadder->setServiceDns(m_ServiceDns);
-  }
-  m_EoRadder->Configure();
-  m_EoRadder->setIsSaver(m_isSaver);
-  m_EoRadder->setSaveonUpdate(m_SaveonUpdate);
-  m_AdderSys->add(m_EoRadder);
-  if (m_isSaver)  {
-    m_EoRSaver = new SaveTimer(m_EoRadder,m_SaveInterval);
-    m_EoRSaver->setPartName(m_PartitionName);
-    m_EoRSaver->setRootDir(m_SaveRootDir);
-    m_EoRSaver->setTaskName(m_SaverTaskName);
-    m_EoRSaver->setEOR(true);
-    m_EoRSaver->setSaveSetService(m_SaveTimer->getSaveSetService());
-    if (!m_SaveonUpdate)    {
-      m_EoRadder->SetCycleFn(EORSaver,(void*)m_EoRSaver);
-    }
+    if ( m_pauseOnEOR ) adder->SetPauseFn(::doPause,this);
+    adder->runAware       = false;
+    adder->servicePattern = m_servicePattern + "EOR(.*)";
+    adder->rectmo = (m_eorTmoFactor == 0) ? 500*m_recvtmo : m_eorTmoFactor * m_recvtmo;
   }
-  m_started = true;
+  adder->configure();
   return StatusCode::SUCCESS;
 }
 
 StatusCode AdderSvc::stop()   {
   m_errh->stop();
-  MsgStream msg( msgSvc(), name() );
-  msg << MSG::DEBUG << "AdderSvc Stop called" << endmsg;
-  if (m_dohisto)  {
-    IGauchoMonitorSvc* psvc = dynamic_cast<IGauchoMonitorSvc*>(m_pMonitorSvc);
-    if (psvc) psvc->resetHistos(this);
-  }
-  
-  if (m_isSaver)  {
-//    m_SaveTimer->stop();
-  }
   return Service::stop();
 }
 
 StatusCode AdderSvc::finalize()  {
   MsgStream msg( msgSvc(), name() );
-  msg << MSG::DEBUG << "AdderSvc finalize called" << endmsg;
-  {
-    DimLock l;
-    if (m_arrhist != 0)
-    {
-  //    m_adder->m_histo = 0;
-  //    m_phistsvc->unregisterObject((AIDA::IBaseHistogram*)m_arrhist);
-    }
+  msg << MSG::DEBUG << "AdderSvc finalize called" << endmsg;  {
+    DimLock lock;
     MonInfo::setShutdownInProgress(true);
-    m_arrhist = 0;
-    if (m_adder != 0)    {
-      m_adder->histo = nullptr;
-    }
-    if ( m_pMonitorSvc )    {
-      m_pMonitorSvc->undeclareAll(this);
-    }
-    if ( m_incidentSvc )    {
-      m_incidentSvc->removeListener(this);
+    if ( this->incidentSvc )    {
+      this->incidentSvc->removeListener(this);
+      this->incidentSvc.reset();
     }
-    releasePtr(m_incidentSvc);
-    releasePtr(m_phistsvc);
-    releasePtr(m_pMonitorSvc);
-    if (m_SaveTimer != 0)
-    {
-      m_SaveTimer->stop();
-      deletePtr(m_SaveTimer);
+    if (this->eorSaver != 0)    {
+      this->eorSaver->stop();
+      this->eorSaver.reset();
     }
-    if (m_AdderSys != &AdderSys::Instance())
-    {
-      printf("****** m_AdderSys was overwritten!!! Reestablishing it...\n");
-      m_AdderSys = &AdderSys::Instance();
+    AdderSys::instance().stop();
+    if ( this->intervalAdder )    {
+      this->intervalAdder->stop();
+      this->intervalAdder.reset();
     }
-    if (m_AdderSys !=0)  m_AdderSys->stop();
-    if (m_adder != 0)
-    {
-      m_adder->stop();
-      m_AdderSys->remove(m_adder);
-      deletePtr(m_adder);
-    }
-    if (m_EoRadder != 0)
-    {
-      m_EoRadder->stop();
-      m_AdderSys->remove(m_EoRadder);
-      deletePtr(m_EoRadder);
+    if ( this->eorAdder )    {
+      this->eorAdder->stop();
+      this->eorAdder.reset();
     }
   }
   return Service::finalize();
 }
 
-void AdderSvc::gotoPause()
-{
-  m_incidentSvc->fireIncident(Incident(name(),"DAQ_PAUSE"));
+void AdderSvc::gotoPause()   {
+  this->incidentSvc->fireIncident(Incident(name(),"DAQ_PAUSE"));
 }
 
-void AdderSvc::handle(const Incident& inc)
-{
-  if (inc.type() == "APP_RUNNING")
-  {
-    m_AdderSys->start();
+void AdderSvc::handle(const Incident& inc)   {
+  if (inc.type() == "APP_RUNNING")    {
+    AdderSys::instance().start();
   }
 }
diff --git a/Online/GauchoAppl/src/AdderSys.cpp b/Online/GauchoAppl/src/AdderSys.cpp
index cc87e60f4eb3f42b29206f98dcfcde3c740b4e11..4b3ce216c1a501ab06c0af47b48981aeed27dfce 100644
--- a/Online/GauchoAppl/src/AdderSys.cpp
+++ b/Online/GauchoAppl/src/AdderSys.cpp
@@ -27,7 +27,7 @@ void AdderSys::feedSources(void* tag, void** address, int* size, int* /* first *
     str << "Task-Sources:" << m.size() << '#';
     for( auto s = m.begin(); s != m.end(); )
       str << *s << (++s == m.end() ? "" : "|");
-    sys->source_buffer = std::move(str.str());
+    sys->source_buffer = str.str();
     *size    = sys->source_buffer.length()+1;
     *address = (void*)sys->source_buffer.c_str();
     return;
@@ -36,10 +36,8 @@ void AdderSys::feedSources(void* tag, void** address, int* size, int* /* first *
   *address = (char*)"";
 }
 
-AdderSys::AdderSys()   {
-  auto svc = RTL::processName()+"/task_sources";
+AdderSys::AdderSys() : sourceSvc_id(0)  {
   this->taskHandler = std::make_unique<HAdderTaskInfoHandler>();
-  this->sourceSvc_id = ::dis_add_service(svc.c_str(),"C",0,0,feedSources,(long)this);
 }
 
 AdderSys::~AdderSys()   {
@@ -55,15 +53,26 @@ void AdderSys::add(MonAdder *a)   {
   this->adderList.push_back(a);
 }
 
+void AdderSys::trackSources()   {
+  if ( 0 == this->sourceSvc_id )   {
+    auto svc = RTL::processName()+"/task_sources";
+    this->sourceSvc_id = ::dis_add_service(svc.c_str(),"C",0,0,feedSources,(long)this);
+  }
+}
+
 void AdderSys::addSource(const std::string& src)   {
   this->sources.emplace(src);
-  ::dis_update_service(this->sourceSvc_id);
+  if ( this->sourceSvc_id ) ::dis_update_service(this->sourceSvc_id);
 }
 
 void AdderSys::removeSource(const std::string& src)   {
   auto i = this->sources.find(src);
-  if ( i != this->sources.end() ) this->sources.erase(i);
-  ::dis_update_service(this->sourceSvc_id);
+  if ( i != this->sources.end() )  {
+    this->sources.erase(i);
+    if ( this->sourceSvc_id )  {
+      ::dis_update_service(this->sourceSvc_id);
+    }
+  }
 }
 
 void AdderSys::remove(MonAdder *a)   {
@@ -75,7 +84,7 @@ void AdderSys::remove(MonAdder *a)   {
   }
 }
 
-AdderSys &AdderSys::Instance()    {
+AdderSys &AdderSys::instance()    {
   static AdderSys s;
   return s;
 }
diff --git a/Online/GauchoAppl/src/ClassDescriptor.cpp b/Online/GauchoAppl/src/ClassDescriptor.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5f02de081b517d3013f4a4d32ec37004d5fe6346
--- /dev/null
+++ b/Online/GauchoAppl/src/ClassDescriptor.cpp
@@ -0,0 +1,127 @@
+//==========================================================================
+//  LHCb Online software suite
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see OnlineSys/LICENSE.
+//
+// Author     : B.Jost
+//
+//==========================================================================
+#include <Gaucho/MonInfo.h>
+#include <Gaucho/ObjService.h>
+#include <GauchoAppl/MonAdder.h>
+#include <GauchoAppl/AddSerializer.h>
+#include <RTL/strdef.h>
+#include <RTL/rtl.h>
+
+#include <sstream>
+
+using namespace Online;
+
+namespace  {
+  static int mpty = 0;
+}
+
+TimeoutCmd::TimeoutCmd(DimServerDns *dns, const std::string& nam, const std::string& svc, MonAdder *tis)
+  : DimCommand(dns,nam.c_str(),"I"), adder(tis), service(svc)  {
+}
+
+TimeoutCmd::TimeoutCmd(const std::string& nam, const std::string& svc, MonAdder *tis)
+  : DimCommand(nam.c_str(),"I"), adder(tis), service(svc)  {
+}
+
+void TimeoutCmd::commandHandler()  {
+  ::lib_rtl_output(LIB_RTL_INFO,"Received Timeout Command for service %s", this->service.c_str());
+  auto [class_map, run] = this->adder->get_class_map(this->service, false);
+  if ( class_map )   {
+    auto clit = class_map->find(MonAdder::getClassName(this->service));
+    if ( clit != class_map->end() )   {
+      this->adder->handleTimeout(clit->second);
+    }
+  }
+}
+
+ClassDescriptor::ClassDescriptor(const std::string& nam, MonAdder* a)
+  : name(nam), adder(a)
+{
+  this->buffer = std::make_shared<mem_buff>();
+}
+
+ClassDescriptor::~ClassDescriptor()   {
+  //printf("ClassDescriptor: %s\n",name.c_str());
+}
+
+void ClassDescriptor::operator()(void* data, int size, MonInfo* info)    {
+  this->adder->process_buffer(data, size, info);
+}
+
+bool ClassDescriptor::addService(const std::string& service, const std::string& task)    {
+  auto i = this->inputServices.find(service);
+  if ( i == this->inputServices.end() )    {
+    auto mi = std::make_unique<MonInfo>(service, this);
+    this->inputServices.emplace(service, std::make_unique<INServiceDescr>(task, service, std::move(mi)));
+    return true;
+  }
+  return false;
+}
+
+void ClassDescriptor::enableOutput(std::shared_ptr<DimServerDns>& dns, const std::string& svc, unsigned int run)   {
+  if ( !this->outputservice )   {
+    std::string service = svc + (this->name.empty() ? std::string("") : "." + this->name);
+    if ( run != 0 )   {
+      std::stringstream run_str;
+      run_str << run;
+      service = RTL::str_replace(service, "<runno>", run_str.str());
+    }
+    this->outputservice = 
+      std::make_unique<ObjService>(dns, std::move(std::make_unique<AddSerializer>(this->monitorItems)),
+				   service, "C", &mpty, 4, this->buffer);
+    ::lib_rtl_output(LIB_RTL_INFO,"+++ Booked Output Service %s", this->outputservice->getName());
+  }
+}
+
+void* ClassDescriptor::allocate(size_t siz)   {
+  return this->buffer->allocate(siz, true);
+}
+
+void ClassDescriptor::adoptItems(const void* data, size_t size)   {
+  this->buffer->copy(data, size);
+  this->monitorItems.clear();
+  this->adder->load_item_map(this->monitorItems, *this->buffer);
+  this->adder->load_item_map(*this->buffer);
+}
+
+void ClassDescriptor::addItem(const std::string& name, DimBuffBase* data)    {
+  size_t used_size = this->buffer->used();
+  void* oldbuffer = this->buffer->begin();
+  int hsiz = data->reclen;
+  this->reallocate(hsiz);
+  this->buffer->append(data, hsiz);
+  const char *nam = add_ptr<char>(data,data->nameoff);
+  if (strcmp(nam,name.c_str()) != 0)   {
+    ::printf("[ERROR] Name Mismatch in new adder entry (%s) and Map (%s)\n", nam, name.c_str());
+  }
+  void* newbuffer = this->buffer->begin();
+  if ( newbuffer != oldbuffer )      {
+    this->adder->load_item_map(this->monitorItems, *this->buffer);
+    this->adder->load_item_map(*this->buffer);
+  }
+  else   {
+    this->monitorItems.emplace(nam, this->buffer->at<DimBuffBase>(used_size));
+    BRTLLock::_Lock lock(&this->adder->maplock);
+    this->adder->monitorItems.emplace(nam, this->buffer->at<DimBuffBase>(used_size));
+  }
+}
+
+void* ClassDescriptor::reallocate(size_t incsiz)    {
+  size_t used = this->buffer->used();
+  size_t incr = incsiz > used ? incsiz : used;
+  size_t newsiz = used + incr;
+  if ( this->buffer->length() < newsiz )  {
+    this->buffer->reallocate(newsiz);
+    this->buffer->at<SerialHeader>(0)->buffersize = this->buffer->length();
+  }
+  return this->buffer->begin();
+}
diff --git a/Online/GauchoAppl/src/CounterAdder.cpp b/Online/GauchoAppl/src/CounterAdder.cpp
index a3580a529918090e8be1e7d57ca20dc621c7cd1b..ea819ca1cb1424f6599f138232d5f8f394472c51 100644
--- a/Online/GauchoAppl/src/CounterAdder.cpp
+++ b/Online/GauchoAppl/src/CounterAdder.cpp
@@ -9,288 +9,68 @@
 // Author     : B.Jost
 //
 //==========================================================================
+#include <Gaucho/dimhist.h>
 #include <GauchoAppl/CounterAdder.h>
-#include <GauchoAppl/ClassDescriptor.h>
-#include <GauchoAppl/AdderSys.h>
 
-#include <Gaucho/MonBase.h>
-#include <Gaucho/Utilities.h>
-#include <Gaucho/IGauchoMonitorSvc.h>
-
-#include <AIDA/IHistogram1D.h>
-
-using namespace Online;
-
-CounterAdder::CounterAdder(const char *myName, const char *serviceName)
-{
-  m_serviceName = serviceName;
-  m_MyName      = myName;
-  m_type        = ADD_COUNTER;
-  AdderSys::Instance().add(this);
-}
-
-CounterAdder::~CounterAdder()
-{
-  AdderSys::Instance().remove(this);
-}
-
-void CounterAdder::add(void *buff, int siz, MonInfo *h)
-{
-  addBuffer(buff,siz,h);
-}
-
-void CounterAdder::addBuffer(void *buff, int siz, MonInfo *minfo)
-{
-  MonMap  hmap;
-  void   *bend   = AddPtr(buff,siz);
-  void   *hstart = ((SerialHeader*)buff)->endPtr();//AddPtr(buff,sizeof(SerialHeader));
-  DimHistbuff1 *pp = (DimHistbuff1*)hstart;
-  while (pp<bend)
-  {
-    if (pp->reclen == 0) break;
-    if (!offsetinBounds(pp,pp->reclen,pp->nameoff))
-    {
-      ::lib_rtl_output(LIB_RTL_INFO,
-		       "+++ Counter Adder: Bad value of name offset (%d). Corrupted record? Source %s",
-		       pp->nameoff,minfo->getName());
-      break;
-    }
-    char *nam = add_ptr<char>(pp,pp->nameoff);
-    char pnam[2048];
-    if (!offsetinBounds(pp,pp->reclen,pp->dataoff))    {
-      ::lib_rtl_output(LIB_RTL_INFO,
-		       "+++ Counter Adder: Bad value of data offset (%d [%0x] > %d). Corrupted record for %s? Source %s",
-		       pp->dataoff,pp->dataoff,pp->reclen,nam,minfo->getName());
-//      printf("+++ Counter Adder: Bad value of data offset (%d [%0x] > %d). Corrupted record for %s?\n",pp->dataoff,pp->dataoff,pp->reclen,nam);
-      break;
-    }
-    int limit = 2048;
-    int nlen  = ::strnlen(nam, limit);
-    if ( nlen == limit )
-    {
-      ::strncpy(pnam,nam,limit-1);
-      pnam[sizeof(pnam)-1] = 0;
-      printf("+++ Counter Adder: Very large name string. First 2048 characters %s out of %d. Skipping record...\n",pnam,pp->namelen);
-      break;
-    }
-    hmap.insert(std::make_pair(nam,pp));
-    pp=(DimHistbuff1*)AddPtr(pp,pp->reclen);
-  }
-
-  int count =0;
-  for (const auto& o : hmap )  {
-    const std::string& IFirst  = o.first;
-    MonBase*           ISecond = (MonBase*)o.second;
-    MonIter j = this->currentClass->m_hmap.find(IFirst);
-    if ( j != this->currentClass->m_hmap.end() )    {
-      //printf("Counter Adder: Locking MAP\n");
-      ++count;
-      LockMap();
-      std::string JFirst = j->first;
-      DimHistbuff1 *JSecond = (DimHistbuff1*)j->second;
-      DimHistbuff1 *sumh = (DimHistbuff1*)(j->second);
-      DimHistbuff1 *srch = (DimHistbuff1*)(o.second);
-      if (!offsetinBounds(sumh,sumh->reclen,sumh->dataoff))
-      {
-        ::lib_rtl_output(LIB_RTL_INFO,
-			 "Bad Data offset in sum (first source %s) source %s record %s Loop Record number %d",
-			 this->currentClass->m_firstSource.c_str(),minfo->getName(),JFirst.c_str(),count);
-        UnLockMap();
-        break;
-      }
-      double *ps = (double*)AddPtr(sumh,sumh->dataoff);
-      double *ph = (double*)AddPtr(srch,srch->dataoff);
-      switch(srch->type)
-      {
-        case C_LONGPAIR:
-        case C_INTPAIR:
-        {
-          long *d = (long*)ps;
-          long *s = (long*)ph;
-          d[0] += s[0];
-          d[1] += s[1];
-          break;
-        }
-        case C_INT:
-        case C_LONGLONG:
-        case C_ATOMICINT:
-        case C_ATOMICLONG:
-        case C_GAUDIACCLONG:
-        case C_GAUDIACCINT:
-          {
-            *(long long*)ps += *(long long*)ph;
-            break;
-          }
-        case C_UINT:
-        case C_ULONG:
-          {
-            *(unsigned long*)ps += *(unsigned long*)ph;
-            break;
-          }
-        case C_FLOAT:
-        case C_RATEFLOAT:
-          {
-            *(float*)ps += *(float*)ph;
-            break;
-          }
-        case C_DOUBLE:
-        case C_RATEDOUBLE:
-        case C_ATOMICFLOAT:
-        case C_ATOMICDOUBLE:
-        case C_GAUDIACCFLOAT:
-        case C_GAUDIACCDOUBLE:
-          {
-            *(double*)ps += *(double*)ph;
-            break;
-          }
-        case C_INTSTAR:
-        {
-          int n = (srch->reclen - srch->dataoff)/sizeof(int);
-          int indx;
-          int *sum = (int*)ps;
-          int *src = (int*)ph;
-          for (indx = 0;indx<n;indx++)
-          {
-            sum[indx]+=src[indx];
-          }
-          break;
-        }
-        case C_UINTSTAR:
-        {
-          int n = (srch->reclen - srch->dataoff)/sizeof(unsigned int);
-          int indx;
-          unsigned int *sum = (unsigned int*)ps;
-          unsigned int *src = (unsigned int*)ph;
-          for (indx = 0;indx<n;indx++)
-          {
-            sum[indx]+=src[indx];
-          }
-          break;
-        }
-        case C_ULONGSTAR:
-        {
-          int n = (srch->reclen - srch->dataoff)/sizeof(unsigned long);
-          int indx;
-          unsigned long *sum = (unsigned long*)ps;
-          unsigned long *src = (unsigned long*)ph;
-          for (indx = 0;indx<n;indx++)
-          {
-            sum[indx]+=src[indx];
-          }
-          break;
-        }
-        case C_FLOATSTAR:
-        {
-          int n = (srch->reclen - srch->dataoff)/sizeof(float);
-          int indx;
-          float *sum = (float*)ps;
-          float *src = (float*)ph;
-          for (indx = 0;indx<n;indx++)
-          {
-            sum[indx]+=src[indx];
-          }
-          break;
-        }
-        case C_DOUBLESTAR:
-        case C_RATEDOUBLESTAR:
-        {
-          int n = (srch->reclen - srch->dataoff)/sizeof(double);
-          int indx;
-          double *sum = (double*)ps;
-          double *src = (double*)ph;
-          for (indx = 0;indx<n;indx++)
-            sum[indx]+=src[indx];
-          break;
-        }
-        case C_LONGSTAR:
-        {
-          int n = (srch->reclen - srch->dataoff)/sizeof(long);
-          int indx;
-          long *sum = (long*)ps;
-          long *src = (long*)ph;
-          char txt[10000];
-          ::sprintf(txt,"%p %p, %p %p",(void*)IFirst.c_str(),(void*)ISecond,(void*)JFirst.c_str(),(void*)JSecond);
-          for (indx = 0;indx<n;indx++)
-          {
-            sum[indx]+=src[indx];
-          }
-          ::sprintf(txt,"%p %p, %p %p",(void*)IFirst.c_str(),(void*)ISecond,(void*)JFirst.c_str(),(void*)JSecond);
-          break;
-        }
-        case   C_GAUDIAVGACCd:
-        {
-          long *suml = (long*)ps;
-          *suml += *(long*)ph;
-          double *sr = (double*)AddPtr(ph,sizeof(long));
-          double *sumd = (double*)AddPtr(suml,sizeof(long));
-          *sumd += *sr;
-          break;
-        }
-        case C_GAUDIBINACC:
-        case   C_GAUDIAVGACCl:
-        {
-          long *sum = (long*)ps;
-          long *srl =  (long*)ph;
-          sum[0] += srl[0];
-          sum[1] += srl[1];
-          break;
-        }
-
-        default:     {
-	  printf("Unknown data type to add...%x\n",srch->type);
-	  break;
-	}
-      }
-      //printf("Counter Adder: UNLocking MAP\n");
-      UnLockMap();
-    }
-    else   {
-      DimHistbuff1 *srch = (DimHistbuff1*)(o.second);
-      int csiz = this->currentClass->m_usedSize;
-      int hsiz = srch->reclen;
-      //printf("Counter Adder: Locking MAP\n");
-      LockMap();
-      void *p = ReAllocate(hsiz);
-      if ( p != 0 )      {
-        p = add_ptr(p,csiz);
-        ::memcpy(p, srch, hsiz);
-        this->currentClass->m_usedSize += hsiz;
-        if ( offsetinBounds(srch,srch->reclen,srch->nameoff) )    {
-          char *nam = add_ptr<char>(srch,srch->nameoff);
-          if ( offsetinBounds(srch,srch->reclen,srch->dataoff) )    {
-            this->currentClass->m_hmap[nam] = (DimBuffBase*)p;
-          }
-          else     {
-            ::lib_rtl_output(LIB_RTL_INFO,"Bad Data offset in adding new record %s Offset %d %0x.\n",nam,srch->dataoff,srch->dataoff);
-          }
-        }
-        else        {
-          printf("ERROR: +++++++++++ Bad Name Offset (%d, %0x) for Counter %s\n",srch->nameoff,srch->nameoff,IFirst.c_str());
-        }
-      }
-      //printf("Counter Adder: UNLocking MAP\n");
-      UnLockMap();
-    }
+void Online::CounterAdder::add_item(DimBuffBase* summed_item, const DimBuffBase* source_item)   {
+  switch(source_item->type)      {
+  case C_LONGPAIR:
+  case C_INTPAIR:
+    add_pair<long int>(summed_item, source_item);
+    break;
+  case C_INT:
+  case C_LONGLONG:
+  case C_ATOMICINT:
+  case C_ATOMICLONG:
+  case C_GAUDIACCLONG:
+  case C_GAUDIACCINT:
+    add_number<long long int>(summed_item, source_item);
+    break;
+  case C_UINT:
+  case C_ULONG:
+    add_number<unsigned long>(summed_item, source_item);
+    break;
+  case C_FLOAT:
+  case C_RATEFLOAT:
+    add_number<float>(summed_item, source_item);
+    break;
+  case C_DOUBLE:
+  case C_RATEDOUBLE:
+  case C_ATOMICFLOAT:
+  case C_ATOMICDOUBLE:
+  case C_GAUDIACCFLOAT:
+  case C_GAUDIACCDOUBLE:
+    add_number<double>(summed_item, source_item);
+    break;
+  case C_INTSTAR:
+    add_array<int>(summed_item, source_item);
+    break;        
+  case C_UINTSTAR:
+    add_array<unsigned int>(summed_item, source_item);
+    break;
+  case C_LONGSTAR:
+    add_array<long int>(summed_item, source_item);
+    break; 
+  case C_ULONGSTAR:
+    add_array<unsigned long int>(summed_item, source_item);
+    break; 
+  case C_FLOATSTAR:
+    add_array<float>(summed_item, source_item);
+    break; 
+  case C_DOUBLESTAR:
+  case C_RATEDOUBLESTAR:
+    add_array<double>(summed_item, source_item);
+    break; 
+  case   C_GAUDIAVGACCd:
+    add_gaudi_average(summed_item, source_item);
+    break;
+  case C_GAUDIBINACC:
+  case   C_GAUDIAVGACCl:
+    add_pair<long>(summed_item, source_item);
+    break;
+  default:
+    printf("Unknown data type to add...%x\n",source_item->type);
+    break;
   }
-  this->currentClass->m_received++;
-  this->currentClass->m_added++;
 }
 
-void CounterAdder::Update()
-{
-  if (m_isSaver)   {
-    if (m_locked)    {
-      m_locked = false;
-      UnLock();
-    }
-  }
-  ////printf(" %d %d\n", m_received,expected);
-  if (this->currentClass->m_outservice != 0)  {
-    if (this->debugOn)    {
-      ::lib_rtl_output(LIB_RTL_INFO,"++++++CounterAdder: Updating Output Service %s for Adder %s++++++\n",
-		       this->currentClass->m_outservice->getName(), this->name.c_str());
-    }
-    this->currentClass->m_outservice->Serialize(-1);
-    this->currentClass->m_outservice->Update();
-  }
-}
diff --git a/Online/GauchoAppl/src/HistAdder.cpp b/Online/GauchoAppl/src/HistAdder.cpp
index d14d4461da3692d53bee77da2e76939c2cccbafe..2f1d22498e474c46847941340f3ed6f724f73b09 100644
--- a/Online/GauchoAppl/src/HistAdder.cpp
+++ b/Online/GauchoAppl/src/HistAdder.cpp
@@ -10,223 +10,94 @@
 //
 //==========================================================================
 #include "GauchoAppl/HistAdder.h"
-#include "Gaucho/ObjService.h"
-#include "Gaucho/MonServer.h"
-#include "Gaucho/ObjRPC.h"
-#include "Gaucho/MonHist.h"
-#include "Gaucho/RootHists.h"
-#include "GauchoAppl/RateService.h"
-#include "Gaucho/Utilities.h"
-#include "GauchoAppl/AdderSys.h"
-#include "GauchoAppl/ClassDescriptor.h"
-#include "TDirectory.h"
-#include "dim/dis.hxx"
 
-#include <vector>
-#include <cstring>
-#include <cstdio>
+void Online::HistAdder::add_item(DimBuffBase* summed, const DimBuffBase* source)   {
 
-using namespace Online;
-
-HistAdder::HistAdder(const char *myName, const char *serviceName)   {
-  m_serviceName = serviceName;
-  m_MyName      = myName;
-  m_type        = ADD_HISTO;
-  AdderSys::Instance().add(this);
-}
-
-HistAdder::~HistAdder()   {
-  AdderSys::Instance().remove(this);
-}
+  if ( source->type == C_STATENT )   {
+    DimStatBuff *s = (DimStatBuff*)source;
+    DimStatBuff *d = (DimStatBuff*)summed;
+    d->nentries += s->nentries;
+    d->sumw     += s->sumw;
+    d->sumw2    += s->sumw2;
+    d->min       = std::min(d->min,s->min);
+    d->min       = std::max(d->max,s->max);
+    return;
+  }
 
-void HistAdder::add(void *buff, int siz, MonInfo *h)   {
-  addBuffer(buff,siz,h);
-}
+  auto *sumh = (DimHistbuff1*)summed;
+  auto *srch = (DimHistbuff1*)source;
+  auto* ps   = add_ptr<double>(summed,summed->dataoff);
+  auto* ph   = add_ptr<double>(source,source->dataoff);
+  sumh->nentries += srch->nentries;
+  sumh->sumw   += srch->sumw;
+  sumh->sumw2  += srch->sumw2;
+  sumh->sumwx  += srch->sumwx;
+  sumh->sumwx2 += srch->sumwx2;
+  sumh->sumwx3 += srch->sumwx3;
+  sumh->sumwx4 += srch->sumwx4;
+  sumh->sumwy  += srch->sumwy;
+  sumh->sumwy2 += srch->sumwy2;
+  sumh->sumwy3 += srch->sumwy3;
+  sumh->sumwy4 += srch->sumwy4;
 
-void HistAdder::addBuffer(void *buff, int siz, MonInfo* /* HTsk */)   {
-  MonMap hmap;
-  hmap.clear();
-  void *bend = AddPtr(buff,siz);
-  void *hstart = ((SerialHeader*)buff)->endPtr();
-  DimHistbuff1 *pp = (DimHistbuff1*)hstart;
-  while (pp<bend)  {
-    if (pp->reclen == 0) break;
-    char *nam = (char*)AddPtr(pp,pp->nameoff);
-    hmap.emplace(nam,pp);
-    pp = (DimHistbuff1*)AddPtr(pp,pp->reclen);
+  int ndble = 0;
+  switch(srch->type)    {
+  case H_1DIM:
+  case H_GAUDIH1F:
+  case H_GAUDIH1D:
+    ndble = 2*(srch->x.nbin+2);
+    break;
+  case H_2DIM:
+  case H_GAUDIH2F:
+  case H_GAUDIH2D:    {
+    DimHistbuff2 *s = (DimHistbuff2*)srch;
+    ndble = 2*(s->x.nbin+2)*(s->y.nbin+2);
+    break;
   }
-  for (MonIter i=hmap.begin();i!=hmap.end();i++)  {
-    MonIter j = this->currentClass->m_hmap.find(i->first);
-    if (j != this->currentClass->m_hmap.end())    {
-      LockMap();
-      DimHistbuff1 *sumh = (DimHistbuff1*)(j->second);
-      DimHistbuff1 *srch = (DimHistbuff1*)(i->second);
-      double* ps = (double*)AddPtr(sumh,sumh->dataoff);
-      double* ph = (double*)AddPtr(srch,srch->dataoff);
-      if (srch->type == C_STATENT)
-      {
-        DimStatBuff *s=(DimStatBuff*)srch;
-        DimStatBuff *d=(DimStatBuff*)sumh;
-        d->nentries += s->nentries;
-        d->sumw   += s->sumw;
-        d->sumw2  += s->sumw2;
-        d->min     = std::min(d->min,s->min);
-        d->min     = std::max(d->max,s->max);
-        UnLockMap();
-        continue;
-      }
-      sumh->nentries += srch->nentries;
-      sumh->sumw   += srch->sumw;
-      sumh->sumw2  += srch->sumw2;
-      sumh->sumwx  += srch->sumwx;
-      sumh->sumwx2 += srch->sumwx2;
-      sumh->sumwx3 += srch->sumwx3;
-      sumh->sumwx4 += srch->sumwx4;
-      sumh->sumwy  += srch->sumwy;
-      sumh->sumwy2 += srch->sumwy2;
-      sumh->sumwy3 += srch->sumwy3;
-      sumh->sumwy4 += srch->sumwy4;
-      ////printf("Histogram %s Number of Entries %f\n",(char*)AddPtr(sumh,sumh->nameoff),sumh->nentries);
-      int ndble;
-      switch(srch->type)
-      {
-      case H_1DIM:
-      case H_GAUDIH1F:
-      case H_GAUDIH1D:
-        {
-          ndble = 2*(srch->x.nbin+2);
-          break;
-        }
-      case H_2DIM:
-      case H_GAUDIH2F:
-      case H_GAUDIH2D:
-        {
-          //2*(m_nx+2)*(m_ny+2)
-          DimHistbuff2 *s = (DimHistbuff2*)srch;
-          ndble = 2*(s->x.nbin+2)*(s->y.nbin+2);
-          break;
-        }
-      case H_3DIM:
-      case H_GAUDIH3F:
-      case H_GAUDIH3D:
-        {
-          //2*(m_nx+2)*(m_ny+2)
-          DimHistbuff3 *s = (DimHistbuff3*)srch;
-          ndble = 2*(s->x.nbin+2)*(s->y.nbin+2)*(s->z.nbin+2);
-          break;
-        }
-      case H_PROFILE:
-      case H_RATE:
-      case   H_GAUDIPR1:        {
-          ndble = 4*(srch->x.nbin+2);
-          break;
-        }
-      case H_2DPROFILE:
-      case H_GAUDIPR2:
-        {
-          DimHistbuff3 *s = (DimHistbuff3*)srch;
-          ndble = 4*(s->x.nbin+2)*(s->y.nbin+2);
-          break;
-        }
-      default:
-        {
-          ndble = 0;
-          break;
-        }
-      }
-      int icpy;
-      switch(srch->type)
-      {
-      case H_RATE:
-        {
-          m_RateBuff = sumh;
-          for (icpy=0;icpy<5;icpy++)
-          {
-            ps[icpy]+=ph[icpy];
-          }
-          for (icpy=8;icpy<ndble;icpy++)
-          {
-            ps[icpy]+=ph[icpy];
-          }
-          break;
-        }
-      case H_GAUDIPR1:
-      case H_GAUDIPR2:
-      {
-        GaudiProfileBin *psrc = (GaudiProfileBin*)AddPtr(sumh,sumh->dataoff);
-        GaudiProfileBin *pdst = (GaudiProfileBin*)AddPtr(srch,srch->dataoff);
-        for (int i = 0;i<ndble;i++)
-        {
-          pdst[i].nent += psrc[i].nent;
-          pdst[i].sumw += psrc[i].sumw;
-          pdst[i].sumw2 += psrc[i].sumw2;
-        }
-        break;
-      }
-      default:
-        {
-          for (icpy=0;icpy<ndble;icpy++)
-          {
-            ps[icpy]+=ph[icpy];
-          }
-          break;
-        }
-      }
-      //printf("HistAdder UNLocking MAP\n");
-      UnLockMap();
-    }
-    else    {
-      int csiz = this->currentClass->m_usedSize;
-      DimHistbuff1 *srch = (DimHistbuff1*)(i->second);
-      int   hsiz = srch->reclen;
-      void *p = ReAllocate(hsiz);
-      //printf("HistAdder Locking MAP\n");
-      LockMap();
-      if ( p != 0)  {
-        p = AddPtr(p, csiz);
-        ::memcpy(p, srch, hsiz);
-        this->currentClass->m_usedSize += hsiz;
-        const char *nam = (char*)AddPtr(srch,srch->nameoff);
-        if (strcmp(nam,i->first.c_str()) != 0)   {
-          printf("[ERROR] Name Mismatch in new histogram (%s)and Map (%s)\n",nam,i->first.c_str());
-        }
-        this->currentClass->m_hmap.emplace(nam,p);
-      }
-      if (m_isSaver)    {
-//        fprintf(logFile,"Histogram Map after Re-Allocating\n");
-//        m_hmap.dumpKeys(logFile);
-//        fprintf(logFile,"Histograms in Serialize Buffer after Re-Allocating\n");
-//        void *bend = AddPtr(m_buffer,m_usedSize);
-//        void *hstart = AddPtr(m_buffer,sizeof(SerialHeader));
-//        DimHistbuff1 *pp = (DimHistbuff1*)hstart;
-//        while (pp<bend)
-//        {
-//          if (pp->reclen == 0) break;
-//          char *nam = (char*)AddPtr(pp,pp->nameoff);
-//          fprintf(logFile,"Buffer Histogram: %s\n",nam);
-//          pp=(DimHistbuff1*)AddPtr(pp,pp->reclen);
-//        }
-
-      }
-      //printf("HistAdder UNLocking MAP\n");
-      UnLockMap();
-//      fflush(logFile);
-    }
+  case H_3DIM:
+  case H_GAUDIH3F:
+  case H_GAUDIH3D:   {
+    DimHistbuff3 *s = (DimHistbuff3*)srch;
+    ndble = 2*(s->x.nbin+2)*(s->y.nbin+2)*(s->z.nbin+2);
+    break;
   }
-  this->currentClass->m_received++;
-  this->currentClass->m_added++;
-}
-
-void HistAdder::Update()  {
-  if (m_isSaver)  {
-    if (m_locked)    {
-      m_locked = false;
-      UnLock();
+  case H_PROFILE:
+  case H_RATE:
+  case H_GAUDIPR1:
+    ndble = 4*(srch->x.nbin+2);
+    break;
+  case H_2DPROFILE:
+  case H_GAUDIPR2:    {
+    DimHistbuff3 *s = (DimHistbuff3*)srch;
+    ndble = 4*(s->x.nbin+2)*(s->y.nbin+2);
+    break;
+  }
+  default:
+    ndble = 0;
+    break;
+  }
+  switch(srch->type)     {
+  case H_RATE:
+    this->rateBuff = sumh;
+    for (int icpy=0;icpy<5;icpy++)
+      ps[icpy] += ph[icpy];
+    for (int icpy=8;icpy<ndble;icpy++)
+      ps[icpy] += ph[icpy];
+    break;
+  case H_GAUDIPR1:
+  case H_GAUDIPR2:  {
+    auto *psrc = add_ptr<GaudiProfileBin>(sumh,sumh->dataoff);
+    auto *pdst = add_ptr<GaudiProfileBin>(srch,srch->dataoff);
+    for (int i = 0;i<ndble;i++)   {
+      pdst[i].nent  += psrc[i].nent;
+      pdst[i].sumw  += psrc[i].sumw;
+      pdst[i].sumw2 += psrc[i].sumw2;
     }
+    break;
   }
-  if ( this->currentClass->m_outservice )  {
-    this->currentClass->m_outservice->Serialize(-1);
-    this->currentClass->m_outservice->Update();
-    this->currentClass->m_updated = true;
+  default:
+    for (int icpy=0; icpy < ndble; icpy++)
+      ps[icpy] += ph[icpy];
+    break;
   }
 }
diff --git a/Online/GauchoAppl/src/InfoHandlers.cpp b/Online/GauchoAppl/src/InfoHandlers.cpp
index e14dfee090da118f889eb431ce63ed4c9dae9b8e..e89b2e9488a0284ba0c59690088ce1908a35339c 100644
--- a/Online/GauchoAppl/src/InfoHandlers.cpp
+++ b/Online/GauchoAppl/src/InfoHandlers.cpp
@@ -19,7 +19,8 @@
 #include <GauchoAppl/InfoHandlers.h>
 #include <GauchoAppl/AdderSys.h>
 #include <GauchoAppl/MonAdder.h>
-#include <Gaucho/Utilities.h>
+#include <RTL/strdef.h>
+#include <RTL/rtl.h>
 #include <dim/dic.h>
 
 /// C/C++ include files
@@ -28,9 +29,8 @@
 using namespace std;
 using namespace Online;
 
-HAdderServiceInfoHandler::HAdderServiceInfoHandler(const std::string& svc)
-  : task(svc)
-{
+HAdderServiceInfoHandler::HAdderServiceInfoHandler(const std::string& svc)   {
+  task = svc.substr(0, svc.find("/SERVICE_LIST"));
   this->id = ::dic_info_service(svc.c_str(), MONITORED,
 				0, 0, 0, HAdderServiceInfoHandler::callback, 
 				(long)this, (char*)"DEAD", 5);
@@ -51,8 +51,8 @@ void HAdderServiceInfoHandler::callback(void* tag, void* address, int* size)   {
 }
 
 void HAdderServiceInfoHandler::analyze_services(const char* input)   {
-  auto& alist = AdderSys::Instance().adderList;
-  int   level = AdderSys::Instance().debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
+  auto& alist = AdderSys::instance().adderList;
+  int   level = AdderSys::instance().debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
   //level = LIB_RTL_ALWAYS;
 
   if ( !input || ::strlen(input) == 0 )  {
@@ -62,28 +62,33 @@ void HAdderServiceInfoHandler::analyze_services(const char* input)   {
   ::lib_rtl_output(level,"Service List %s data: %s",task.c_str(), input);
   if ( ::strcmp(input, "DEAD" ) == 0 )  {
     ::lib_rtl_output(level,"Service Info Handler from %s DEAD",task.c_str());
-    task = task.substr(0, task.find("/SERVICE_LIST"));
     for ( auto* i : alist )
       i->removeTask(task);
     return;
   }
-
-  bool add = false;
-  unique_ptr<dyn_string> service_list(Strsplit(input,"\n"));
-  task = task.substr(0, task.find("/SERVICE_LIST"));
-  if ( (input[0] == '+') || (input[0] == '-') || (input[0] == '!') )  {
+  int action = 0;
+  vector<string> service_list;
+  switch(input[0])   {
+  case '+':
+    service_list = RTL::str_split(input+1,"\n");
+    action =  1;
+    break;
+  case '-':
+    service_list = RTL::str_split(input+1,"\n");
+    action = -1;
+    break;
+  case '!':
+    break;
+  default:
+    service_list = RTL::str_split(input,"\n");
+    action =  1;
+    break;
+  }
+  if ( !service_list.empty() && (action == 1 || action == -1) )  {
     ::lib_rtl_output(LIB_RTL_DEBUG,"Processing incremental list %s", task.c_str());
-    for ( string svc : *service_list )    {
-      if ( svc[0] == '+' )      {
-	add = true;
-	svc = svc.substr(1);
-      }
-      if ( svc[0] == '-' )      {
-	add = false;
-	svc = svc.substr(1);
-      }
+    for ( string svc : service_list )    {
       svc = svc.substr(0, svc.find('|'));
-      if ( add )   {
+      if ( action == 1 )   {
 	::lib_rtl_output(level,"Selective New Service: %s",svc.c_str());
 	for ( auto* i : alist )
 	  i->addService(task, svc);
@@ -94,17 +99,7 @@ void HAdderServiceInfoHandler::analyze_services(const char* input)   {
 	  i->removeService(task, svc);
       }
     }
-    return;
-  }
-  /// Process full list on connection
-  vector<string> newServices;
-  ::lib_rtl_output(level,"Processing full list %s", task.c_str());
-  for (auto svc : *service_list )    {
-    svc = svc.substr(0, svc.find('|'));
-    newServices.push_back(svc);
   }
-  for ( auto* i : alist )
-    i->synchronizeServices(task, newServices);
 }
 
 /// DimInfo overload to process messages
@@ -133,7 +128,7 @@ void HAdderTaskInfoHandler::stop()   {
 }
 
 void HAdderTaskInfoHandler::analyze_tasks(const char* input)   {
-  auto& sys = AdderSys::Instance();
+  auto& sys = AdderSys::instance();
   int level = sys.debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
   //level = LIB_RTL_ALWAYS;
   if (strcmp(input, "DEAD") == 0)  {
@@ -144,32 +139,32 @@ void HAdderTaskInfoHandler::analyze_tasks(const char* input)   {
     return;
   }
   int action = 0;
-  unique_ptr<dyn_string> server_list;
+  vector<string> server_list;
 
   ::lib_rtl_output(level,"Task Info Handler Input %s",input);
 
   switch(input[0])   {
   case '+':
-    server_list.reset(Strsplit(input+1,"|"));
+    server_list = RTL::str_split(input+1,"|");
     action =  1;
     break;
   case '-':
-    server_list.reset(Strsplit(input+1,"|"));
+    server_list = RTL::str_split(input+1,"|");
     action = -1;
     break;
   case '!':
     break;
   default:
-    server_list.reset(Strsplit(input,"|"));
+    server_list = RTL::str_split(input,"|");
     action =  1;
     break;
   }
-  if ( !server_list.get() || server_list->empty() )   {
+  if ( server_list.empty() )   {
     return;
   }
 
-  auto& alist = AdderSys::Instance().adderList;
-  for (auto server : *server_list )  {
+  auto& alist = AdderSys::instance().adderList;
+  for (auto server : server_list )  {
     ::lib_rtl_output(level,"Differential Server List: Server Name %s... New: %d Dead: %d",
 		     server.c_str(), action>0 ? 1 : 0, action<0 ? 1 : 0);
 
diff --git a/Online/GauchoAppl/src/MonAdder.cpp b/Online/GauchoAppl/src/MonAdder.cpp
index 7e86613778bf1ffb435a01fd01a36522ef935afe..6ff438d9e7d3507534fa41f94cce58f0312200ca 100644
--- a/Online/GauchoAppl/src/MonAdder.cpp
+++ b/Online/GauchoAppl/src/MonAdder.cpp
@@ -14,271 +14,211 @@
 #include <GauchoAppl/MonAdder.h>
 
 #include <Gaucho/ObjRPC.h>
-#include <Gaucho/dimhist.h>
-#include <Gaucho/MonTypes.h>
-#include <Gaucho/Utilities.h>
+#include <Gaucho/ObjService.h>
 #include <Gaucho/SerialHeader.h>
 
 #include <GauchoAppl/AddTimer.h>
-#include <GauchoAppl/AdderSys.h>
 #include <GauchoAppl/AdderSvc.h>
+#include <GauchoAppl/AdderSys.h>
 #include <GauchoAppl/SaveTimer.h>
+#include <GauchoAppl/RunManager.h>
 #include <GauchoAppl/AddSerializer.h>
-#include <Gaucho/IGauchoMonitorSvc.h>
-#include <GauchoAppl/ClassDescriptor.h>
-
-#include <AIDA/IHistogram1D.h>
 
 #include <RTL/strdef.h>
-#include <WT/wtdef.h>
-#include <dim/dim.h>
 
 #include <sstream>
 #include <exception>
 
-static int mpty;
 using namespace std;
 using namespace boost;
 using namespace Online;
 
-typedef pair<string, MonBase*> MonPair;
-
-namespace {
-  class HistoCBParam
-  {
-  public:
-    MonAdder           *m_thisinstance { nullptr };
-    vector<HistEntry*> *m_HistActions  { nullptr };
+#define offsetinBounds(base,recl,offs) !((add_ptr(base,offs)>add_ptr(base,recl))||(add_ptr(base,offs)<base))
 
-    HistoCBParam(MonAdder *tis,vector<HistEntry*> *hque) : m_thisinstance(tis), m_HistActions(hque)
-    {
-    }
-  };
-
-  void BufferAdder(void *tis, void *buff, int siz, MonInfo *h)  {
-    MonAdder *adder = (MonAdder*)tis;
-    if (adder->test)
-      adder->BasicAdd(buff, siz,h);
-    else
-      adder->basicAdd(buff, siz,h);
-  }
+MonAdder::MonAdder(const std::string& tsk, const std::string& myNam, const std::string& svcNam, int typ)   {
+  this->serviceName = svcNam;
+  this->myName      = myNam;
+  this->task        = tsk;
+  this->type        = typ;
+  this->runManager  = make_unique<RunManager>();
+  AdderSys::instance().add(this);
+}
 
-  int HistogramCallback(unsigned int ,void* param)  {
-    if ((long)param < 0x60) return WT_SUCCESS;
-    HistoCBParam *par = (HistoCBParam*)param;
-    MonAdder *madder = par->m_thisinstance;
-    if (madder == 0)
-      {
-	delete par;
-	return WT_SUCCESS;
-      }
-    if (par->m_HistActions == 0)
-      {
-	delete par;
-	return WT_SUCCESS;
-      }
-    par->m_thisinstance->FillHistos(*par->m_HistActions);
-    delete par->m_HistActions;
-    delete par;
-    return WT_SUCCESS;
+MonAdder::~MonAdder()  {
+  if ( this->sourceSvc_id )  {
+    ::dis_remove_service(this->sourceSvc_id);
+    this->sourceSvc_id = 0;
   }
+  this->rpc.reset();
+  AdderSys::instance().remove(this);
 }
 
-string Online::getClassName(const string &service)
-{
+string MonAdder::getClassName(const string &service)   {
   size_t dot = service.rfind(".");
   return (dot != string::npos) ? service.substr(dot+1) : string();
 }
 
-ClassDescriptor::ClassDescriptor()
-{
-  m_default =0;
-  m_outservice=0;
-  m_ser=0;
-  m_buffer=0;
-  m_buffersize=0;
-  m_usedSize=0;
-  m_expected=0;
-  m_reference=0;
-  m_received=0;
-  m_added=0;
-  m_updated=0;
-  m_timeout=0;
-  m_updateStamp=0;
-  m_time0=0;
-  m_Dimcmd=0;
-  m_buffadd = &m_buffer;
+void MonAdder::SetCycleFn(void CycleCB(void*, mem_buff&, MonitorItems*, MonAdder *), void *tis)     {
+  this->CycleFn  = CycleCB;
+  this->CycleArg = tis;
 }
 
-ClassDescriptor::~ClassDescriptor()   {
-  deletePtr(m_outservice);
-  deletePtr(m_ser);
-  deletePtr(m_Dimcmd);
-}
-
-ClassMap::~ClassMap() {
-  for (auto i = begin(); i!= end(); i++)
-    deletePtr(i->second);
+void MonAdder::SetPauseFn(void Pause(void*), void *tis)  {
+  this->PauseFn  = Pause;
+  this->PauseArg = tis;
 }
 
 void MonAdder::feedSources(void* tag, void** address, int* size, int* /* first */)   {
   if ( tag && address && size )   {
     std::stringstream str;
     MonAdder* adder = *(MonAdder**)tag;
-    str << "Service-Sources:" << adder->classMap->size() << '#';
-    for( const auto& cl : *adder->classMap )  {
-      const auto& m = cl.second->m_inputServicemap;
-      str << '{' << (cl.first.empty() ? "**default**" : cl.first.c_str()) << ":{";
-      for (auto s = m.begin(); s != m.end(); )
-	str << s->first << (++s == m.end() ? "" : "|");
-      str << '}';
+    auto [m, run] = adder->get_class_map("",false);
+    if ( m )   {
+      str << "Service-Sources:" << m->size() << '#';
+      for( const auto& cl : *m )  {
+	const auto& m = cl.second->inputServices;
+	str << '{' << (cl.first.empty() ? "**default**" : cl.first.c_str()) << ":{";
+	for (auto s = m.begin(); s != m.end(); )
+	  str << s->first << (++s == m.end() ? "" : "|");
+	str << '}';
+      }
+      adder->source_buffer = str.str();
+      *size    = adder->source_buffer.length()+1;
+      *address = (void*)adder->source_buffer.c_str();
+      return;
     }
-    adder->source_buffer = std::move(str.str());
-    *size    = adder->source_buffer.length()+1;
-    *address = (void*)adder->source_buffer.c_str();
-    return;
   }
   *size = 0;
   *address = (char*)"";
 }
 
-MonAdder::MonAdder()
-{
-  this->classMap = new ClassMap();
-}
-
-void MonAdder::FillHistos(vector<HistEntry*> &hact)  {
-  if (this->monSvc != 0) this->monSvc->Lock();
-  for (size_t i=0;i<hact.size();i++)  {
-    if (hact[i]->h != 0)    {
-      hact[i]->h->fill(hact[i]->value);
-    }
-    delete hact[i];
-  }
-  if (this->monSvc != 0) this->monSvc->UnLock();
-  hact.clear();
-}
-
-MonAdder::~MonAdder()  {
-  if ( this->sourceSvc_id )  {
-    ::dis_remove_service(this->sourceSvc_id);
-    this->sourceSvc_id = 0;
-  }
-  wtc_flush(WT_FACILITY_USER1);
-  this->m_TaskServiceMap.clear();
-  this->inputServicemap.clear();
-  for (auto& i : *this->classMap )
-    deletePtr(i.second);
-
-  m_rpc.reset();
-}
-
-void MonAdder::Configure()   {
-  string dim_svc = RTL::processName() + "/" + this->m_MyName + "/Debug";
+void MonAdder::configure()   {
+  string dim_svc = RTL::processName() + "/Debug/" + this->task;
   string nodename = RTL::str_lower(RTL::nodeNameShort());
-  this->name= "MON_" + this->m_MyName;
-
-  wtc_init();
-  wtc_subscribe(WT_FACILITY_USER1,0,&HistogramCallback);
+  this->name= "MON_" + this->myName;
 
-  if ( this->runAware )
-    m_RunManager.clear();
-  else
-    this->classMap = new ClassMap();
+  this->runManager->clear();
 
-  if (m_type == ADD_COUNTER)   {
-    dim_svc      += "/counter_sources/" + m_serviceName;
-    m_serviceName = (this->runAware ? "/Counter/<runno>/" : "/Counter/") + m_serviceName;
+  if (this->type == ADD_COUNTER)   {
+    dim_svc += "/counter_sources/" + this->serviceName;
+    this->serviceName = (this->runAware ? "/Counter/<runno>/" : "/Counter/") + this->serviceName;
   }
-  else if (m_type == ADD_HISTO)   {
-    dim_svc       += "/histo_sources/" + m_serviceName;
-    m_serviceName = (this->runAware ? "/Histos/<runno>/" : "/Histos/") + m_serviceName;
+  else if (this->type == ADD_HISTO)   {
+    dim_svc += "/histo_sources/" + this->serviceName;
+    this->serviceName = (this->runAware ? "/Histos/<runno>/" : "/Histos/") + this->serviceName;
   }
-  if ( 0 == this->sourceSvc_id )  {
+  if ( this->trackSources && 0 == this->sourceSvc_id )  {
     this->sourceSvc_id = ::dis_add_service(dim_svc.c_str(),"C",0,0,feedSources,(long)this);
   }
 
-  m_outsvcname = this->name+this->m_serviceName;
-  this->cmdName = nodename+"_"+RTL::processName()+"/"+m_MyName+/*"/"+*/m_serviceName+"/Timeout";
-  m_timer = new AddTimer(this);
-  m_serviceexp = boost::regex(this->servicePattern.c_str(),boost::regex_constants::icase);
-  m_taskexp = boost::regex(this->taskPattern.c_str(),boost::regex_constants::icase);
-  m_rpc = nullptr;
+  this->cmdName = nodename+"_"+RTL::processName() + "/" + myName + this->serviceName+"/Timeout";
+  this->timer = make_unique<AddTimer>(this);
+  this->service_regex = boost::regex(this->servicePattern.c_str(),boost::regex_constants::icase);
+  this->task_regex = boost::regex(this->taskPattern.c_str(),boost::regex_constants::icase);
+
+  if ( this->isSaver )   {
+    this->lockid = make_unique<BRTLLock>();
+    this->lockid->m_name = this->name+"AdderLock";
+  }
+
+  this->rpc.reset();
   if ( !this->noRPC )  {
-    if ( m_type == ADD_HISTO )
-      m_RPCName = this->name + "/Histos/HistCommand";
-    else if ( m_type == ADD_COUNTER )
-      m_RPCName = this->name+"/Counter/HistCommand";
-    m_maplock.m_name = m_RPCName;
+    string rpcName;
+    if ( this->type == ADD_HISTO )
+      rpcName = this->name + "/Histos/HistCommand";
+    else if ( this->type == ADD_COUNTER )
+      rpcName = this->name+"/Counter/HistCommand";
+
+    this->maplock.m_name = rpcName;
+    this->rpc = make_unique<ObjRPC>(this->serviceDNS,
+				    make_unique<AddSerializer>(this->monitorItems),
+				    rpcName,
+				    "I:1;C","C", &this->maplock, nullptr);
   }
 }
 
-void *MonAdder::Allocate(size_t siz)   {
-  if (this->currentClass->m_buffersize<siz)  {
-    if (this->currentClass->m_buffer != 0)    {
-      free (this->currentClass->m_buffer);
+void MonAdder::load_item_map(mem_buff& buffer)    {
+  void*    bend   = add_ptr(buffer.begin(), buffer.used());
+  void*    hstart = buffer.at<SerialHeader>(0)->endPtr();
+  auto*    pp = (DimBuffBase*)hstart;
+  const char *nam = "";
+  while ( pp < bend )    {
+    if ( pp->reclen <= 0 )    {
+      ::lib_rtl_output(LIB_RTL_INFO,"Bad Record length (<=0). Last valid Element %s Pointers: (start, end, curr) %p %p %p\n",nam,hstart,bend,pp);
+      break;
     }
-    this->currentClass->m_buffer = malloc(siz);
-    if (this->currentClass->m_buffer != 0)    {
-      ::memset(this->currentClass->m_buffer,0,siz);
-      this->currentClass->m_buffersize = siz;
+    if ( offsetinBounds(pp,pp->reclen,pp->nameoff) )    {
+      nam = add_ptr<char>(pp,pp->nameoff); {
+	BRTLLock::_Lock lock(&this->maplock);
+	this->monitorItems.emplace(nam, pp);
+      }
+      if ( pp->type == H_RATE )
+	this->rateBuff = pp;
     }
+    else    {
+      ::lib_rtl_output(LIB_RTL_INFO,
+		       "+++ MonAdder: Bad value of name offset (%d). Corrupted record?",pp->nameoff);
+      break;
+    }
+    pp = add_ptr<DimBuffBase>(pp,pp->reclen);
   }
-  return this->currentClass->m_buffer;
 }
 
-void *MonAdder::ReAllocate(size_t incsiz)
-{
-  void *newbuffer;
-  size_t inc = incsiz>this->currentClass->m_usedSize?incsiz:this->currentClass->m_usedSize;
-  size_t newsiz = this->currentClass->m_usedSize+inc;
-  if (this->currentClass->m_buffer == 0)  {
-    return Allocate(newsiz);
+void MonAdder::load_item_map(MonitorItems& m, mem_buff& buffer)    {
+  void*    bend   = add_ptr(buffer.begin(), buffer.used());
+  void*    hstart = buffer.at<SerialHeader>(0)->endPtr();
+  auto*    pp = (DimBuffBase*)hstart;
+  const char *nam = "";
+  m.clear();
+  while ( pp < bend )    {
+    if ( pp->reclen <= 0 )    {
+      ::lib_rtl_output(LIB_RTL_INFO,"Bad Record length (<=0). Last valid Element %s Pointers: (start, end, curr) %p %p %p\n",nam,hstart,bend,pp);
+      break;
+    }
+    if ( offsetinBounds(pp,pp->reclen,pp->nameoff) )    {
+      nam = add_ptr<char>(pp,pp->nameoff);
+      m.emplace(nam, pp);
+    }
+    else 
+      ::lib_rtl_output(LIB_RTL_INFO,"Problem in reallocating buffer: Name offset in record bad. %d (%0x)\n",pp->nameoff,pp->nameoff);
+    pp = add_ptr<DimBuffBase>(pp,pp->reclen);
   }
-  if ( this->currentClass->m_buffersize < newsiz )  {
-    newbuffer = realloc(this->currentClass->m_buffer, newsiz);
-    if ( newbuffer != 0 )   {
-      if ( newbuffer != this->currentClass->m_buffer )      {
-        this->currentClass->m_hmap.clear();
-        void *bend = AddPtr(newbuffer,this->currentClass->m_usedSize);
-        void *hstart = ((SerialHeader*)newbuffer)->endPtr();//AddPtr(newbuffer,sizeof(SerialHeader));
-        DimBuffBase *pp = (DimBuffBase*)hstart;
-        const char *nam = "";
-        while (pp<bend)    {
-          if (pp->reclen <= 0)    {
-            ::lib_rtl_output(LIB_RTL_INFO,"Bad Record length (<=0). Last valid Element %s Pointers: (start, end, curr) %p %p %p\n",nam,hstart,bend,pp);
-            break;
-          }
-          if ( offsetinBounds(pp,pp->reclen,pp->nameoff) )    {
-            nam = add_ptr<char>(pp,pp->nameoff);
-            this->currentClass->m_hmap[nam] = pp;
-            m_itemmap[nam] = (MonBase*)pp;
-          }
-          else     {
-            ::lib_rtl_output(LIB_RTL_INFO,"Problem in reallocating buffer: Name offset in record bad. %d (%0x)\n",pp->nameoff,pp->nameoff);
-          }
-          pp = add_ptr<DimBuffBase>(pp,pp->reclen);
-        }
-        this->currentClass->m_buffer = newbuffer;
-      }
-      this->currentClass->m_buffersize = newsiz;
-      SerialHeader *hd = (SerialHeader*)this->currentClass->m_buffer;
-      hd->buffersize += incsiz;
+}
+
+std::pair<std::shared_ptr<ClassMap>, unsigned int>
+MonAdder::get_class_map(const std::string& service, bool create)     {
+  if ( this->runAware && !service.empty() )   {
+    auto items = RTL::str_split(service,"/");
+    string rnstring = items.at(items.size()-2);
+    unsigned int rn = stoi(rnstring);
+    auto i = this->runManager->find(rn);
+    if (i != this->runManager->end())  {
+      return make_pair(i->second, rn);
     }
-    else    {
-      ::free(this->currentClass->m_buffer);
-      this->currentClass->m_buffersize = 0;
-      this->currentClass->m_buffer = 0;
+    if ( create )   {
+      auto m = std::make_shared<ClassMap>();
+      this->runManager->emplace(rn, m);
+      return make_pair(m, rn);
     }
+    return make_pair(std::shared_ptr<ClassMap>(), 0);
+  }
+  auto i = this->runManager->find(0);
+  if (i != this->runManager->end())  {
+    return make_pair(i->second, 0);
+  }
+  if ( create )   {
+    auto m = std::make_shared<ClassMap>();
+    this->runManager->emplace(0, m);
+    return make_pair(m, 0);
   }
-  return this->currentClass->m_buffer;
+  return make_pair(std::shared_ptr<ClassMap>(), 0);
 }
 
 string MonAdder::taskName(const string &server)   {
   bool status = false;
   boost::cmatch what;
   try  {
-    status = boost::regex_search(server.c_str(),what,m_taskexp);
+    status = boost::regex_search(server.c_str(),what,this->task_regex);
   }
   catch (std::exception &e)  {
     ::lib_rtl_output(LIB_RTL_ERROR,"Caught standard exception in TaskName: what = %s\n",e.what());
@@ -289,92 +229,55 @@ string MonAdder::taskName(const string &server)   {
   return (status) ? server : string();
 }
 
-INServiceDescr *MonAdder::findINService(const string& servc)   {
-  auto i = this->inputServicemap.find(servc);
-  return (i == this->inputServicemap.end()) ? 0 : i->second.get();
-}
-
 void MonAdder::addTask(const string &task)  {
   auto i = this->taskInventory.find(task);
   if ( i == this->taskInventory.end() )  {
-    int level = AdderSys::Instance().debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
+    int level = AdderSys::instance().debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
     this->taskInventory[task] = std::set<std::string>();
     ::lib_rtl_output(level,"Adder[%s] add task: %s", name.c_str(), task.c_str());
   }
 }
 
 void MonAdder::removeTask(const string& task)   {
-  int level = AdderSys::Instance().debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
+  int level = AdderSys::instance().debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
   auto tsk = this->taskInventory.find(task);
   if ( tsk == this->taskInventory.end() )   {
     ::lib_rtl_output(level,"TaskDied: Task = %s, not found in TaskInventory\n",task.c_str());
     return;
   }
   ::lib_rtl_output(level,"TaskDied: Task = %s, found. Scanning Services\n",task.c_str());
+  auto class_name = getClassName(task);
   for (const auto& serv : tsk->second )  {
-    ClassDescriptor *cld = this->classMap->FindClass(serv);
-    if (cld == 0)     {
-      if (this->debugOn) ::lib_rtl_output(level,"TaskDied: Class not found");
-      continue;
-    }
-    ::lib_rtl_output(level,"TaskDied: Class  found Class Name %s\n",cld->m_Name.c_str());
-    auto j = cld->m_inputServicemap.find(serv);
-    if (j != cld->m_inputServicemap.end())    {
-      cld->m_inputServicemap.erase(j);
-      if (cld->m_inputServicemap.size() == 0)     {
-        deletePtr(cld->m_outservice);
-        deletePtr(cld->m_Dimcmd);
-      }
-    }
-  }
-  this->taskInventory.erase(tsk);
-  ::lib_rtl_output(level,"TaskDied: Size of m_TaskInventory %d\n",this->taskInventory.size());
-  if (this->taskInventory.size() == 0)
-  {
-    ::lib_rtl_output(level,"TaskDied: m_TaskInventory now empty\n Deleting our general services\n");
-    m_rpc.reset();
-    m_RPCser.reset();
-  }
-}
-
-void MonAdder::synchronizeServices(const string& task, const vector<string>& service_list)  {
-  std::string taskname = this->taskName(task);
-  if ( !taskname.empty() )    {
-    int level = AdderSys::Instance().debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
-    for ( size_t i=0; i < service_list.size(); i++ )
-      addService(taskname, service_list[i]);
-
-    bool fnd = false;
-    vector<string> toRemoveList;
-    auto ii = m_TaskMap.find(taskname);
-    if ( ii != m_TaskMap.end() )  {
-      const string& service = ii->second;
-      for ( size_t i=0; i<service_list.size(); i++ )    {
-	if ( service_list[i] == service )    {
-	  fnd = true;
-	  break;
+    for ( const auto& m : *this->runManager )   {
+      auto& clmap = m.second;
+      if ( clmap )    {
+	auto clit = clmap->find(class_name);
+	if ( clit == clmap->end() )     {
+	  if (this->debugOn) ::lib_rtl_output(level,"TaskDied: Class not found");
+	  continue;
+	}
+	auto& cl = clit->second;
+	::lib_rtl_output(level,"TaskDied: Class  found Class Name %s\n",cl->name.c_str());
+	auto j = cl->inputServices.find(serv);
+	if ( j != cl->inputServices.end() )    {
+	  cl->inputServices.erase(j);
+	  if ( cl->inputServices.size() == 0 )   {
+	    cl->outputservice.reset();
+	    cl->tmo_command.reset();
+	  }
 	}
-      }
-      if ( !fnd )    {
-	toRemoveList.push_back(service);
-      }
-      for ( size_t i=0; i<toRemoveList.size(); i++ )    {
-	::lib_rtl_output(level,"removing service %s (%s) from taskname %s apparently matching pattern %s",
-			 toRemoveList[i].c_str(),this->servicePattern.c_str(),
-			 taskname.c_str(),this->taskPattern.c_str());
-	removeService(taskname,toRemoveList[i]);
       }
     }
   }
+  this->taskInventory.erase(tsk);
 }
 
-void MonAdder::addService(const string& task, const string& service)
-{
-  int level  = AdderSys::Instance().debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
+void MonAdder::addService(const string& task, const string& service)   {
+  int level  = AdderSys::instance().debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
   boost::cmatch what;
   int status = 0;
   try  {
-    status = boost::regex_search(service.c_str(), what, m_serviceexp);
+    status = boost::regex_search(service.c_str(), what, this->service_regex);
   }
   catch (std::exception &e)  {
     ::lib_rtl_output(LIB_RTL_ERROR,"Caught standard exception in addService: what = %s",e.what());
@@ -390,117 +293,60 @@ void MonAdder::addService(const string& task, const string& service)
   if (this->taskInventory.find(task) == this->taskInventory.end())    {
     ::lib_rtl_output(level,"New Service '%s' called, add task '%s' to inventory \n",
 		     service.c_str(),task.c_str());
-    this->taskInventory[task].insert(service);
   }
+  this->taskInventory[task].insert(service);
 
-  string rnstring;
-  if ( this->runAware )   {
-    unique_ptr<dyn_string> scomps(Strsplit(service.c_str(),"/"));
-    rnstring = scomps->at(scomps->size()-2);
-    unsigned int rn = stoi(rnstring);
-    ::lib_rtl_output(level,"Adding Service: %s Run Number is %d",service.c_str(),rn);
-    auto i = m_RunManager.find(rn);
-    if (i != m_RunManager.end())  {
-      ::lib_rtl_output(level,"Found Run Number %d in Run Map\n",rn);
-      this->classMap = i->second;
-    }
-    else   {
-      ::lib_rtl_output(level,"Adding Service: %s but Run Number %d not in RunManager. Adding it...",service.c_str(),rn);
-      this->classMap  = new ClassMap();
-      m_RunManager[rn] = this->classMap;
-    }
-  }
+  auto [class_map, run] = this->get_class_map(service, true);
   string classnam = getClassName(service);
-  ::lib_rtl_output(level,"Adding Service: %s Class Name: %s",service.c_str(),classnam.c_str());
-  auto cindx = this->classMap->find(classnam);
-  if (cindx == this->classMap->end())   {
-    auto* cdesc = new ClassDescriptor();
-    cdesc->m_Name = classnam;
-    cindx = this->classMap->emplace(classnam, cdesc).first;
+  ::lib_rtl_output(level,"Adding Service: %s Class Name: %s", service.c_str(), classnam.c_str());
+
+  auto cindx = class_map->find(classnam);
+  if (cindx == class_map->end())   {
+    cindx = class_map->emplace(classnam, make_shared<ClassDescriptor>(classnam, this)).first;
   }
-  ClassDescriptor *cdesc = cindx->second;
-  auto i = cdesc->m_inputServicemap.find(service);
-  if (i == cdesc->m_inputServicemap.end())    {
-    auto mi = make_unique<MonInfo>(service, &BufferAdder, this);
-    cdesc->m_inputServicemap.emplace(service, make_unique<INServiceDescr>(service, mi.release(), task));
-    auto k =cdesc->m_TaskMap.find(task);
-    if (k == cdesc->m_TaskMap.end())      {
-      cdesc->m_TaskMap.emplace(task,service);
+
+  auto& cdesc = cindx->second;
+  if ( cdesc->addService(service, task) )   {
+    if ( 0 != this->sourceSvc_id )  {
+      ::dis_update_service(this->sourceSvc_id);
     }
   }
-  string outservname = m_outsvcname;
-  if (this->runAware) StringReplace(outservname, "<runno>", rnstring);
-  if ( 0 == cdesc->m_outservice )    {
-    if ( this->disableOutput )    {
-      ::lib_rtl_output(level,"Output disabled for: %s",cdesc->m_outservname.c_str());
-    }
-    else   {
-      cdesc->m_ser = new AddSerializer((ObjMap*)&cdesc->m_hmap);
-      cdesc->m_outservname = classnam.empty() ? outservname : outservname+(".")+classnam;
-      ::lib_rtl_output(level,"New Output Service %s",cdesc->m_outservname.c_str());
-      cdesc->m_outservice = new ObjService(m_ServiceDns.get(),cdesc->m_ser,cdesc->m_outservname.c_str(),(char*) "C", (void*) &mpty, 4, cdesc->m_buffadd, &cdesc->m_usedSize);
-    }
+  if ( !this->disableOutput && !cdesc->outputservice )   {
+    cdesc->enableOutput(this->serviceDNS, this->name + this->serviceName, run);
   }
-  if ( 0 == m_rpc )    {
-    if ( !this->noRPC )    {
-      m_RPCser.reset(new AddSerializer((ObjMap*)&m_itemmap));
-      m_rpc.reset(new ObjRPC(this->serviceDns(),m_RPCser.get(),m_RPCName, "I:1;C","C", &m_maplock, nullptr));
-    }
+  if ( !cdesc->tmo_command )    {
+    string tmo_cmd = classnam.empty() ? this->cmdName : this->cmdName + "." + classnam;
+    cdesc->tmo_command = make_unique<TimeoutCmd>(tmo_cmd, service, this);
   }
-  if ( 0 == cdesc->m_Dimcmd )    {
-    string tmo_cmd = classnam.empty() ? this->cmdName : this->cmdName+"."+classnam;
-    cdesc->m_Dimcmd = new TimeoutCmd(tmo_cmd,this);
-  }
-  m_ServiceDns.get() ? DimServer::start(m_ServiceDns.get()) : DimServer::start();
+  this->serviceDNS ? DimServer::start(this->serviceDNS.get()) : DimServer::start();
 }
 
-void MonAdder::removeService(const string &, const string &service)    {
-  if ( this->runAware )  {
-    std::unique_ptr<dyn_string> scomps(Strsplit(service.c_str(),"/"));
-    string rnstring = scomps->at(scomps->size()-2);
-    unsigned int rn = ::stoi(rnstring);
-
-    auto ir = m_RunManager.find(rn);
-    if (ir == m_RunManager.end())    {
-      ::lib_rtl_output(LIB_RTL_ERROR,"Removing Service: %s but Run Number %d not in RunManager\n",service.c_str(),rn);
-      return;
-    }
-    this->classMap = ir->second;
-  }
-  ClassDescriptor *cldes = this->classMap->FindClass(service);
-  if (cldes == 0) return;
-  INServiceMap::iterator i = cldes->m_inputServicemap.find(service);
-  if ( i != cldes->m_inputServicemap.end() )  {
-    auto k = m_TaskMap.find(i->second->task);
-    if (k != m_TaskMap.end())   {
-      m_TaskMap.erase(k);
-    }
-    cldes->m_inputServicemap.erase(i);
-    if (cldes->m_inputServicemap.size() == 0)    {
-//      printf("removeService: Last Service %s removed... Deleting our output service",this->servicePattern.c_str());
-      if (cldes->m_outservice != 0)    {
-//        printf("Name %s\n",cldes->m_outservice->getName());
-      }
-      else
-      {
-//        printf("\n");
+void MonAdder::removeService(const string &task, const string &service)    {
+  auto tsk = this->taskInventory.find(task);
+  if ( tsk != this->taskInventory.end() )    {
+    auto svc = tsk->second.find(service);
+    if ( svc != tsk->second.end() )  {
+      tsk->second.erase(svc);
+    }
+    auto [class_map, run] = this->get_class_map(service, false);
+    if ( class_map )   {
+      auto clit = class_map->find(getClassName(service));
+      if ( clit != class_map->end() )   {
+	auto& cl = clit->second;
+	auto   i = cl->inputServices.find(service);
+	if ( i != cl->inputServices.end() )  {
+	  cl->inputServices.erase(i);
+	  if ( cl->inputServices.empty() )    {
+	    cl->outputservice.reset();
+	    cl->tmo_command.reset();
+	  }
+	}
       }
-      deletePtr(cldes->m_outservice);
-      deletePtr(cldes->m_Dimcmd);
-      if (this->debugOn) ::lib_rtl_output(LIB_RTL_INFO,"removeService: Size of m_TaskMap %d\n",m_TaskMap.size());
     }
   }
 }
 
-void MonAdder::dumpServices()  {
-  INServiceMap::iterator i;
-  for (i=this->inputServicemap.begin();i!=this->inputServicemap.end();i++)  {
-    printf("Service Name:%s\n",i->first.c_str());
-  }
-}
-
-unsigned long long MonAdder::gettime()
-{
+unsigned long long MonAdder::gettime()   {
 #define onesec_nano (unsigned long long)(1000000000)
   unsigned long long timstamp;
   struct timeval tv;
@@ -514,472 +360,126 @@ unsigned long long MonAdder::gettime()
 }
 
 void MonAdder::start()   {
-  if (m_timer != 0)  {
+  if ( this->timer )  {
    ::lib_rtl_output(LIB_RTL_INFO,"MonAdder MonAdder::start called for Service  %s\n",this->name.c_str() );
-   m_timer->startPeriodic(this->rectmo);
+    this->timer->startPeriodic(this->rectmo);
   }
 }
 
 void MonAdder::stop()   {
-  if (m_timer != 0)  {
-    m_timer->stop();
+  if ( this->timer )  {
+    this->timer->stop();
   }
 }
 
-void MonAdder::TimeoutHandler()  {
-  ::lib_rtl_output(LIB_RTL_VERBOSE,"MonAdder Timeout handler for service %s for expected time %lli.Expected Sources %d Received Sources %d\n",
-      this->name.c_str(),this->currentClass->m_reference,this->currentClass->m_expected,this->currentClass->m_received );
+void MonAdder::handleTimeout(std::shared_ptr<ClassDescriptor>& cl)  {
+  ::lib_rtl_output(LIB_RTL_VERBOSE,"MonAdder Timeout: service %s for expected time %lli. Sources expected %d received %d",
+      this->name.c_str(),cl->m_reference,cl->m_expected,cl->m_received );
   if ( !this->test )  {
     for ( auto& i : inputServicemap )    {
       auto& d = i.second;
-      if ( d->last_update < this->currentClass->m_reference )      {
+      if ( d->last_update < cl->m_reference )      {
         d->m_timeouts++;
-        if ( d->m_buffer != 0 )    {
+        if ( d->buffer.begin() )    {
           if (this->debugOn) ::lib_rtl_output(LIB_RTL_VERBOSE,
               "\t===Adding Buffered data from source %s expected %lli last received %lli\n",
-              d->info->targetService.c_str(), this->currentClass->m_reference, d->last_update);
-          this->add(d->m_buffer, d->m_bufsiz, d->info.get());
+              d->info->getName(), cl->m_reference, d->last_update);
+          this->add_items(cl.get(), d->buffer, d->info.get());
         }
         else    {
           if (this->debugOn) ::lib_rtl_output(LIB_RTL_VERBOSE,
               "\t===No buffered data found from source %s expected %lli last received %lli\n",
-              d->info->targetService.c_str(), this->currentClass->m_reference, d->last_update);
-          this->currentClass->m_received++;
-        }
-      }
-    }
-    if (this->debugOn) ::lib_rtl_output(LIB_RTL_VERBOSE,"\t==MonAdder Timeout handler after adding old buffers. Expected Sources %d Received Sources %d\n",
-        this->inputServicemap.size(),this->currentClass->m_received );
-  }
-  this->currentClass->m_timeout = true;
-  if (this->test)  {
-    I_update(true);
-  }
-  else  {
-    i_update(true);
-  }
-}
-
-void MonAdder::i_update(bool force)  {
-  int level  = AdderSys::Instance().debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
-  auto* cl = this->currentClass;
-  ::lib_rtl_output(level,"MonAdder::i_update: Expected Number: %d received: %d force: %s\n",
-		   cl->m_inputServicemap.size(),cl->m_received,force?"true":"false");
-  if ((cl->m_received >= cl->m_inputServicemap.size()) || force)  {
-    if ( this->m_timer && !cl->m_timeout )    {
-      this->m_timer->stop();
-    }
-
-    if (cl->m_reference != cl->m_updateStamp)  {
-      if ( fixRunNumber() )   {
-	::lib_rtl_output(level,"MonAdder::i_update: updating Output Service %s", this->myServiceName.c_str());
-        this->Update();
-        cl->m_updateStamp = cl->m_reference;
-        if ( m_isSaver && m_SaveonUpdate )  {
-	  ::lib_rtl_output(level,"MonAdder::i_update: Calling save Timer for service %s", this->myServiceName.c_str());
-          (this->isEOR)
-	    ? m_parentAdderSvc->m_EoRSaver->timerHandler()
-	    : m_parentAdderSvc->m_SaveTimer->timerHandler();
-        }
-        if (CycleFn != 0)   {
-          (*CycleFn)(CycleCBarg, cl->m_buffer, cl->m_usedSize, &cl->m_hmap, this);
-        }
-        if (m_doPause && PauseFn != 0)   {
-	  (*PauseFn)(PauseArg);
-        }
-      }
-    }
-    if ( this->histo != 0 )    {
-      auto it = this->histQueue.find(cl->m_reference);
-      if ( it == this->histQueue.end() )      {
-        ::lib_rtl_output(LIB_RTL_ERROR,"Histogram queue entry for Adder %s and reference %ld not found\n",
-			 this->m_MyName.c_str(),cl->m_reference);
-      }
-      else      {
-        wtc_insert(WT_FACILITY_USER1,(void*)(new HistoCBParam(this,(*it).second)));
-        this->histQueue.erase(it);
-      }
-    }
-    cl->m_added = 0;
-    cl->m_received = 0;
-    cl->m_reference = 0;
-  }
-}
-
-void MonAdder::I_update(bool force)   {
-  int level  = AdderSys::Instance().debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
-  auto* cl = this->currentClass;
-
-  ::lib_rtl_output(level,"MonAdder::I_update: Expected Number: %d received: %d force: %s\n",
-		   cl->m_inputServicemap.size(),cl->m_received,force?"true":"false");
-
-  if ( (cl->m_received >= cl->m_inputServicemap.size()) || force)   {
-    if ( !cl->m_timeout )    {
-      this->m_timer->stop();
-    }
-    if (cl->m_reference != cl->m_updateStamp)    {
-      ::lib_rtl_output(level,"MonAdder::I_update: updating Output Service %s\n", this->myServiceName.c_str());
-      AddWhatWeHave();
-      if (fixRunNumber())   {
-        Update();
-        cl->m_updateStamp = cl->m_reference;
-        if (m_isSaver && m_SaveonUpdate)    {
-	  ::lib_rtl_output(level,"MonAdder::I_update: Calling save Timer for service%s\n", this->myServiceName.c_str());
-          (this->isEOR)
-            ? m_parentAdderSvc->m_EoRSaver->timerHandler()
-	    : m_parentAdderSvc->m_SaveTimer->timerHandler();
-        }
-        if (CycleFn != 0)   {
-          (*CycleFn)(CycleCBarg, cl->m_buffer, cl->m_usedSize, &cl->m_hmap, this);
-        }
-        if ( m_doPause && PauseFn != 0)     {
-	  (*PauseFn)(PauseArg);
+              d->info->getName(), cl->m_reference, d->last_update);
+          cl->m_received++;
         }
       }
     }
-    if (this->histo != 0)    {
-      auto it = this->histQueue.find(cl->m_reference);
-      if (it == this->histQueue.end())     {
-        ::lib_rtl_output(LIB_RTL_ERROR,"Histogram queue entry for Adder %s and reference %ld not found\n",
-            this->m_MyName.c_str(),cl->m_reference);
-      }
-      else   {
-        wtc_insert(WT_FACILITY_USER1,(void*)(new HistoCBParam(this,(*it).second)));
-        this->histQueue.erase(it);
-      }
-    }
-    cl->m_added = 0;
-    cl->m_received = 0;
-    cl->m_reference = 0;
+    if (this->debugOn) ::lib_rtl_output(LIB_RTL_VERBOSE,"\t==MonAdder Timeout after adding old buffers. Sources expected %d received %d",
+        this->inputServicemap.size(),cl->m_received );
   }
-}
-
-bool MonAdder::fixRunNumber()  {
-  SerialHeader* header= ((SerialHeader*)this->currentClass->m_buffer);
-  if (header == 0)  {
-    return false;
-  }
-  if (header->run_number == 0)  {
-    for ( auto& i : this->currentClass->m_inputServicemap )    {
-      if (i.second->m_buffer != 0)
-      {
-        SerialHeader* h= ((SerialHeader*)i.second->m_buffer);
-        if (h->run_number != 0)
-        {
-          header->run_number = h->run_number;
-          if (this->debugOn) ::lib_rtl_output(LIB_RTL_INFO,"For Adder %s Run Number Fixed to %ld.\n",
-			   this->m_MyName.c_str(), header->run_number);
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-  return true;
+  cl->m_timeout = true;
+  this->finish_cycle(cl, true);
 }
 
 void MonAdder::AddWhatWeHave()   {
-  void *p;
-  size_t siz;
-  if (this->currentClass->m_buffer != 0)  {
-    memset(this->currentClass->m_buffer,0,this->currentClass->m_buffersize);
-  }
-  this->currentClass->m_hmap.clear();
-  for ( auto& it : this->currentClass->m_inputServicemap )  {
-    if (this->currentClass->m_hmap.empty())    {
-      p = it.second->m_buffer;
-      if (p == 0)      {
-        continue;
-      }
-      siz = it.second->m_fragsize;
-      if (this->currentClass->m_buffer == 0)      {
-        this->Allocate(siz);
-      }
-      ::memcpy(this->currentClass->m_buffer,it.second->m_buffer,siz);
-      this->currentClass->m_usedSize = it.second->m_bufsiz;
-      p = this->currentClass->m_buffer;
-      void *bend = AddPtr(p,siz);
-      void *hstart = ((SerialHeader*)p)->endPtr();//AddPtr(p,sizeof(SerialHeader));
-      DimBuffBase *pp = (DimBuffBase*)hstart;
-      const char *nam = "????";
-      while ( pp < bend )  {
-        if (pp->reclen <= 0)    {
-          ::lib_rtl_output(LIB_RTL_INFO,"Bad Record length (%d). Last valid Element %s Pointers: (start, end,curr) %p %p %p\n",pp->reclen,nam,hstart,bend,pp);
-          break;
-        }
-        if (offsetinBounds(pp,pp->reclen,pp->nameoff))   {
-          nam = (char*)AddPtr(pp,pp->nameoff);
-          if (offsetinBounds(pp,pp->reclen,pp->dataoff))    {
-            string nams =nam;
-            //printf("HistAdder Locking MAP\n");
-            LockMap();
-            this->currentClass->m_hmap.insert(make_pair(nams,pp));
-            m_itemmap.insert(make_pair(nams,pp));
-            //printf("HistAdder UNLocking MAP\n");
-            UnLockMap();
-            if ((MONTYPE)pp->type == H_RATE)   {
-              m_RateBuff = pp;
-            }
-          }
-          else     {
-            ::lib_rtl_output(LIB_RTL_INFO,"Data Offset negative or bigger than Record Length for %s %s\n",
-                nam, it.second->info->targetService.c_str());
-          }
-        }
-        else    {
-          ::lib_rtl_output(LIB_RTL_INFO,"Bad Name offset %d (%0x) input service %s from %s\n",
-              pp->nameoff,pp->nameoff, it.second->name.c_str(),it.second->info->targetService.c_str());
-        }
-        pp=(DimBuffBase*)AddPtr(pp,pp->reclen);
-      }
-    }
-    else if (it.second->m_buffer != 0)      {
-      add(it.second->m_buffer,it.second->m_fragsize,it.second->info.get());
-    }
-  }
-}
-
-void MonAdder::BasicAdd(void *buff, int siz, MonInfo *h)   {
-  unsigned long long tim    = gettime();
-  SerialHeader*      header = ((SerialHeader*)buff);
-  this->currentClass = this->classMap->FindClass(h->targetService);
-  if ( siz == 4 )   {
-    ::lib_rtl_output(LIB_RTL_ERROR,"======> No Link from %s. Update counts....\n",h->targetService.c_str());
-    this->currentClass->m_received++;
-    i_update();
-    return;
-  }
-  m_FragmentSize = siz;
-  if (header->m_magic != SERIAL_MAGIC)  {
-    ::lib_rtl_output(LIB_RTL_ERROR,"========> Serial Magic Word Missing from connection %s\n",h->targetService.c_str());
-    this->currentClass->m_received++;
-    i_update();
-    return;
-  }
-  auto it= this->currentClass->m_inputServicemap.find(h->targetService);
-  if (it == this->currentClass->m_inputServicemap.end())  {
-    ::lib_rtl_output(LIB_RTL_ERROR,"!!!!!Logic Error Adder add method called with service that's not in the input service map %s\n",h->targetService.c_str());
-    return;
-  }
-  auto& isvcd = it->second;
-  isvcd->m_pid = DimClient::getServerPid();
-  isvcd->m_timeouts = 0;
-  if ( isvcd->info.get() != h ) isvcd->info.reset(h);
-  this->currentClass->m_expected = this->currentClass->m_inputServicemap.size();
-  long long current  = (this->isEOR) ? header->run_number : header->ser_tim;
-  isvcd->last_update = current;
-  m_RateBuff = 0;
-  if ( this->debugOn )  {
-    ::lib_rtl_output(LIB_RTL_ALWAYS,
-        "MonAdder received packet from %s. Expected Number %d received %d,timestamp %ld current Timestamp %ld\n",
-        h->targetService.c_str(),this->currentClass->m_expected,this->currentClass->m_received,this->currentClass->m_reference,current);
-  }
-  if (this->histo != 0)  {
-    vector<HistEntry*> *histq;
-    if (this->histQueue.find(current) == this->histQueue.end())    {
-      this->histQueue[current] = new vector<HistEntry*>;
-    }
-    histq = this->histQueue[current];
-    unsigned long long dtim = tim-this->currentClass->m_time0;
-    double ftim = dtim/1000000000;
-    histq->push_back(new HistEntry(this->histo,ftim));
-  }
-  if (this->currentClass->m_reference < current)  {
-    if (this->currentClass->m_reference != 0)  {
-//      I_update(true);
-    }
-    if ((this->currentClass->m_received>0) && (this->currentClass->m_received < this->currentClass->m_expected) && !this->currentClass->m_timeout)
-    {
-//      I_update(true);
-//      return;
-    }
-//    printf("First fragment received from %s... starting timer...\n",h->targetService.c_str());
-    this->currentClass->m_timeout = false;
-    this->currentClass->m_firstSource = isvcd->name;
-    if (header->version > 1)
-    {
-      header->level++;
-      unsigned int uintv = header->updateInterval;
-      float tmo;
-      if (header->level == 1)   {
-        tmo = uintv-1.0;
-      }
-      else if (header->level == 2)   {
-        tmo= uintv+5.0;
-      }
-      else if (header->level == 3)   {
-        tmo=uintv+8.0;
-      }
-      else    {
-        tmo=uintv+12.0;
-      }
-      if ( this->isEOR ) tmo = 500*tmo;
-      if ( this->rectmo > 0 )     {
-        if (this->debugOn)      {
-          ::lib_rtl_output(LIB_RTL_INFO,"MonAdder: service %s Header Version %d. Update Interval %d: Setting timeout to %d seconds\n",
-              this->servicePattern.c_str(),header->version,header->updateInterval,int(tmo));
-        }
-        this->m_timer->startPeriodic(tmo);
-      }
-      else      {
-        if (this->debugOn)   {
-          //### ::lib_rtl_output(LIB_RTL_INFO,"MonAdder: service %s Header Version %d. Update Interval %d: No Timout set.\n",
-          //###    this->servicePattern.c_str(),header->version,header->updateInterval);
-        }
-      }
-//      this->m_timer->startPeriodic(tmo);
-
-    }
-    else
-    {
-      if(this->rectmo >0)     {
-        if (this->debugOn)       {
-          ::lib_rtl_output(LIB_RTL_INFO,"MonAdder: service %s Header Version %d. Update Interval %d: Setting timeout to %d seconds\n",
-              this->servicePattern.c_str(),header->version,header->updateInterval,int(this->rectmo));
-        }
-        this->m_timer->startPeriodic(this->rectmo);
-      }
-      else      {
-        if (this->debugOn)        {
-          ::lib_rtl_output(LIB_RTL_INFO,"MonAdder: service %s Header Version %d. Update Interval %d: No Timout set.\n",
-              this->servicePattern.c_str(),header->version,header->updateInterval);
-        }
-      }
-    }
-    this->currentClass->m_time0 = tim;
-    this->currentClass->m_added++;
-    this->currentClass->m_received = 1;
-    isvcd->CpyBuffer(buff,siz);
-    if (m_isSaver)
-    {
-      if (this->currentClass->m_received == 1)
-      {
-        if (!m_locked)
-        {
-          //printf("HistAdder Locking\n");
-          Lock();
-        }
-        m_locked = true;
-      }
+  auto [m, run] = this->get_class_map("", false);
+  auto& cl = m->begin()->second; // SEGV -- don't call
+  cl->buffer->reset();
+  cl->monitorItems.clear();
+  for ( auto& it : cl->inputServices )  {
+    if ( it.second->buffer.used() == 0 )   {
+      continue;
     }
-    ////printf ("New cycle %s... %d\n",h->targetService.c_str(),m_received);
-    this->currentClass->m_reference = current;
-  }
-  else if (this->currentClass->m_reference == current)  {
-    if (this->debugOn)    {
-      ::lib_rtl_output(LIB_RTL_INFO,"MonAdder %s matching TimeStamps... Adding\n",h->targetService.c_str());
+    else if ( cl->monitorItems.empty() )    {
+      cl->buffer->copy(it.second->buffer.begin(), it.second->m_fragsize);
+      this->load_item_map(cl->monitorItems, *cl->buffer);
+      this->load_item_map(*cl->buffer);
     }
-    this->currentClass->m_received++;
-    header= ((SerialHeader*)buff);
-    if (header->version > 1)    {
-      header->level++;
+    else if ( it.second->buffer.begin() )      {
+      add_items(cl.get(), it.second->buffer, it.second->info.get());
     }
-    isvcd->CpyBuffer(buff,siz);
   }
-  else  {
-    if (this->debugOn)    {
-      ::lib_rtl_output(LIB_RTL_INFO,
-          "late update from %s\n m_expected %lli received %lli. Using stored buffer...\n",
-          h->targetService.c_str(),this->currentClass->m_reference,current);
-    }
-    this->currentClass->m_received++;
-    header = ((SerialHeader*)buff);
-    if (header->version > 1)    {
-      header->level++;
-    }
-    isvcd->CpyBuffer(buff,siz);
-  }
-  I_update();
 }
 
-void MonAdder::basicAdd(void *buff, int siz, MonInfo *h)   {
+void MonAdder::process_buffer(void *buff, int siz, MonInfo *h)   {
   unsigned long long tim = gettime();
   SerialHeader* header= ((SerialHeader*)buff);
-  string rnstring;
-  if (this->runAware)  {
-    dyn_string *scomps = Strsplit(h->targetService.c_str(),"/");
-    rnstring = scomps->at(scomps->size()-2);
-    unsigned int rn = stoi(rnstring);
-    if (this->debugOn) ::lib_rtl_output(LIB_RTL_INFO,"Adding Service: %s Run Number is %d\n",h->targetService.c_str(),rn);
-    delete scomps;
-    auto i = m_RunManager.find(rn);
-    if (i != m_RunManager.end())    {
-      if (this->debugOn) ::lib_rtl_output(LIB_RTL_INFO,"Found Run Number %d in Run Map\n",rn);
-      this->classMap = i->second;
-    }
-    else    {
-      ::lib_rtl_output(LIB_RTL_INFO,"basicAdd: %s but Run Number %d not in RunManager. Ignoring...\n",h->targetService.c_str(),rn);
-      return;
-    }
-  }
+  string service = h->getName();
+  auto [class_map, run] = this->get_class_map(service, true);
+  auto classname = getClassName(service);
 
-  string classname = getClassName(h->targetService);
-  if (this->classMap->find(classname) == this->classMap->end())  {
-    ::lib_rtl_output(LIB_RTL_ERROR,"======> basicAdd Called with Service name %s not yet in class map\n",h->targetService.c_str());
+  auto itcl = class_map->find(classname);
+  if ( itcl == class_map->end() )  {
+    ::lib_rtl_output(LIB_RTL_ERROR,"======> process_buffer Called with service %s not in class map",service.c_str());
     return;
   }
-  this->currentClass = this->classMap->at(classname);
+
+  auto& cl = itcl->second;
   if (siz == 4)  {
-    ::lib_rtl_output(LIB_RTL_ERROR,"======> No Link from %s. Update counts....\n",h->targetService.c_str());
-    this->currentClass->m_received++;
-    i_update();
+    ::lib_rtl_output(LIB_RTL_ERROR,"======> No Link from %s. Update counts...",service.c_str());
+    cl->m_received++;
+    this->finish_cycle(cl);
     return;
   }
   if (header->m_magic != SERIAL_MAGIC)  {
-    ::lib_rtl_output(LIB_RTL_ERROR,"========> Serial Magic Word Missing  from connection %s\n",h->targetService.c_str());
-    this->currentClass->m_received++;
-    i_update();
+    ::lib_rtl_output(LIB_RTL_ERROR,"========> Serial Magic Word Missing  from connection %s\n",service.c_str());
+    cl->m_received++;
+    this->finish_cycle(cl);
     return;
   }
-  auto it= this->currentClass->m_inputServicemap.find(h->targetService);
-  if (it == this->currentClass->m_inputServicemap.end())
-  {
-    ::lib_rtl_output(LIB_RTL_ERROR,"!!!!!Logic Error Adder add method called with service that's not in the input service map %s\n",h->targetService.c_str());
+  auto it= cl->inputServices.find(service.c_str());
+  if (it == cl->inputServices.end())  {
+    ::lib_rtl_output(LIB_RTL_ERROR,"!!!!!Logic Error Adder add method called with service that's not in the input service map %s\n",service.c_str());
     return;
   }
-  auto& isvcd = it->second;
-  buff = isvcd->CpyBuffer(buff,siz);
-  isvcd->m_pid = DimClient::getServerPid();
-  isvcd->m_timeouts = 0;
-  if ( isvcd->info.get() != h ) isvcd->info.reset(h);
-  header= ((SerialHeader*)buff);
-//  printf("Received data from %s\n",h->targetService.c_str());
-  this->currentClass->m_expected = this->currentClass->m_inputServicemap.size();
+
+  int level = this->debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
+
+  unique_ptr<INServiceDescr>& descr = it->second;
+  descr->buffer.copy(buff, siz);
+  descr->m_pid = DimClient::getServerPid();
+  descr->m_timeouts = 0;
+  if ( descr->info.get() != h ) descr->info.reset(h); // can this ever happen ??
+  header = descr->buffer.as<SerialHeader>();
+  cl->m_expected = cl->inputServices.size();
+  cl->m_received++;
+
   long long current  = (this->isEOR) ? (unsigned int)header->run_number : header->ser_tim;
-  isvcd->last_update = current;
-  m_RateBuff = 0;
-  if (this->debugOn)  {
-    ::lib_rtl_output(LIB_RTL_INFO,
-        "MonAdder received packet from %s. Expected Number %d received %d,timestamp %ld current Timestamp %ld\n",
-        h->targetService.c_str(),this->currentClass->m_expected,this->currentClass->m_received,this->currentClass->m_reference,current);
-  }
-  if (this->histo != 0)  {
-    vector<HistEntry*> *histq;
-    if (this->histQueue.find(current) == this->histQueue.end())    {
-      this->histQueue[current] = new vector<HistEntry*>;
-    }
-    histq = this->histQueue[current];
-    unsigned long long dtim = tim-this->currentClass->m_time0;
-    double ftim = dtim/1000000000;
-    histq->push_back(new HistEntry(this->histo,ftim));
-  }
-  if ((this->currentClass->m_reference < current) || ((this->currentClass->m_reference <=0) && (this->currentClass->m_received==0)))  {
-    if (this->debugOn)    {
-      ::lib_rtl_output(LIB_RTL_INFO,"MonAdder: First Fragment from %s...\n",h->targetService.c_str());
-    }
-    if ((this->currentClass->m_received>0) && (this->currentClass->m_received < this->currentClass->m_expected) && !this->currentClass->m_timeout)
-    {
-      if (this->debugOn)      {
-        ::lib_rtl_output(LIB_RTL_INFO,"MonAdder: Previous period didn't finish. Expected: %d, received:%d. Forcing update\n",
-            this->currentClass->m_expected, this->currentClass->m_received);
-      }
-      i_update(true);
-//      return;
+  descr->last_update = current;
+  this->rateBuff = 0;
+
+  ::lib_rtl_output(level,
+		   "Packet from %s. Expected Number %d received %d,timestamp %ld current Timestamp %ld\n",
+		   service.c_str(),cl->m_expected,cl->m_received,cl->m_reference,current);
+
+  if ((cl->m_reference < current) || ((cl->m_reference <= 0) && (cl->m_received == 0)))  {
+    ::lib_rtl_output(level,"First Fragment from %s...",service.c_str());
+    if ( (cl->m_received>0) && (cl->m_received < cl->m_expected) && !cl->m_timeout)     {
+      this->finish_cycle(cl, true);
     }
-//    printf("First fragment received from %s... starting timer...\n",h->targetService.c_str());
-    this->currentClass->m_timeout = false;
-    this->currentClass->m_firstSource = isvcd->name;
-    if (header->version > 1)    {
+    cl->m_timeout = false;
+    cl->firstSource = descr->service;
+    if (header->version > 1 )    {
       header->level++;
       unsigned int uintv = header->updateInterval;
       float tmo;
@@ -995,113 +495,141 @@ void MonAdder::basicAdd(void *buff, int siz, MonInfo *h)   {
       else      {
         tmo=0.6*uintv+12.0;
       }
-      if (this->isEOR) tmo = 500*tmo;
-      if(this->rectmo >0)    {
-        if (this->debugOn)
-        {
-          ::lib_rtl_output(LIB_RTL_INFO,"MonAdder: service %s Header Version %d. Update Interval %d: Setting timeout to %d seconds\n",
-              this->servicePattern.c_str(),header->version,header->updateInterval,int(tmo));
-        }
-        this->m_timer->startPeriodic(tmo);
+      if ( this->isEOR ) tmo = 500*tmo;
+      if ( this->rectmo > 0 )    {
+	::lib_rtl_output(level,"Service %s Header Version %d. Update Interval %d: Setting timeout to %d seconds\n",
+			 this->servicePattern.c_str(),header->version,header->updateInterval,int(tmo));
+        this->timer->startPeriodic(tmo);
       }
-      else
-      {
-        if (this->debugOn)     {
-          ::lib_rtl_output(LIB_RTL_INFO,"MonAdder: service %s Header Version %d. Update Interval %d: No Timout set.\n",
-              this->servicePattern.c_str(),header->version,header->updateInterval);
-        }
+      else    {
+	::lib_rtl_output(level,"Service %s Header Version %d. Update Interval %d: No Timout set.\n",
+			 this->servicePattern.c_str(),header->version,header->updateInterval);
       }
     }
-    else
-    {
-      if(this->rectmo >0)
-      {
-        if (this->debugOn)
-        {
-          ::lib_rtl_output(LIB_RTL_INFO,"MonAdder: service %s Header Version %d. Update Interval %d: Setting timeout to %d seconds\n",
-              this->servicePattern.c_str(),header->version,header->updateInterval,int(this->rectmo));
-        }
-        this->m_timer->startPeriodic(this->rectmo);
+    else    {
+      if ( this->rectmo > 0 )   {
+	::lib_rtl_output(level,"Service %s Header Version %d. Update Interval %d: Setting timeout to %d seconds\n",
+			 this->servicePattern.c_str(),header->version,header->updateInterval,int(this->rectmo));
+        this->timer->startPeriodic(this->rectmo);
       }
-      else
-      {
-        if (this->debugOn)
-        {
-          ::lib_rtl_output(LIB_RTL_INFO,"MonAdder: service %s Header Version %d. Update Interval %d: No Timout set.\n",
-              this->servicePattern.c_str(),header->version,header->updateInterval);
-        }
+      else    {
+	::lib_rtl_output(LIB_RTL_INFO,"Service %s Header Version %d. Update Interval %d: No Timout set.\n",
+			 this->servicePattern.c_str(),header->version,header->updateInterval);
       }
     }
-    this->currentClass->m_time0 = tim;
-    this->currentClass->m_added++;
-    this->currentClass->m_received = 1;
-    if (m_isSaver)    {
-      if (this->currentClass->m_received == 1)      {
-        if (!m_locked)        {
-          Lock();
-        }
-        m_locked = true;
-      }
+    cl->m_time0 = tim;
+    cl->m_added++;
+    cl->m_received = 1;
+    if ( this->isSaver && !this->isLocked )   {
+      this->Lock();
+      this->isLocked = true;
     }
-    void *p = Allocate(siz);
-    this->currentClass->m_reference = current;
-    memset(this->currentClass->m_buffer,0,this->currentClass->m_buffersize);
-    this->currentClass->m_hmap.clear();
-    ::memcpy(p,buff,siz);
-    this->currentClass->m_usedSize = siz;
+    cl->m_reference = current;
+    cl->adoptItems(buff, siz);
+  }
+  else if ( cl->m_reference == current )  {
+    this->add_items(cl.get(), descr->buffer, h);
+  }
+  else  {
+    ::lib_rtl_output(level,"late update from %s: m_expected %lli received %lli. Using stored buffer...",
+		     service.c_str(), cl->m_reference, current);
+    this->add_items(cl.get(), descr->buffer, h);
+  }
+  this->finish_cycle(cl);
+}
 
-    void *bend   = AddPtr(p,siz);
-    void *hstart = ((SerialHeader*)p)->endPtr();//AddPtr(p,sizeof(SerialHeader));
-    auto *pp     = (DimBuffBase*)hstart;
-    while (pp<bend)   {
-      if (pp->reclen == 0) break;
-      if (offsetinBounds(pp,pp->reclen,pp->nameoff))   {
-        char *nam = (char*)AddPtr(pp,pp->nameoff);
-        if (offsetinBounds(pp,pp->reclen,pp->dataoff))   {
-          string nams =nam;
-          LockMap();
-          this->currentClass->m_hmap[nams] = pp;
-          m_itemmap[nams] = pp;
-          UnLockMap();
-          if ((MONTYPE)pp->type == H_RATE)     {
-            m_RateBuff = pp;
-          }
+void MonAdder::finish_cycle(std::shared_ptr<ClassDescriptor>& cl, bool force)  {
+  int level  = AdderSys::instance().debugOn ? LIB_RTL_ALWAYS : LIB_RTL_VERBOSE;
+  ::lib_rtl_output(level,"MonAdder::update: Expected: %d received: %d force: %s",
+		   cl->inputServices.size(), cl->m_received, force ? "true" : "false");
+  if ( (cl->m_received >= cl->inputServices.size()) || force )  {
+    if ( this->timer && !cl->m_timeout )    {
+      this->timer->stop();
+    }
+
+    if ( cl->m_reference != cl->m_updateStamp )   {
+      bool fixed = false;
+      if ( cl->buffer->used() > sizeof(SerialHeader) )  {
+	SerialHeader* header= cl->buffer->begin<SerialHeader>();
+	fixed = (header && header->run_number != 0);
+	if ( !fixed )  {
+	  for ( auto& i : cl->inputServices )    {
+	    auto& buff = i.second->buffer;
+	    if ( buff.used() > sizeof(SerialHeader) )  {
+	      SerialHeader* h= i.second->buffer.as<SerialHeader>();
+	      if ( h->run_number != 0 )   {
+		header->run_number = h->run_number;
+		if (this->debugOn) ::lib_rtl_output(LIB_RTL_INFO,"For Adder %s Run Number Fixed to %ld.\n",
+						    this->myName.c_str(), header->run_number);
+		fixed = true;
+	      }
+	    }
+	  }
+	}
+      }
+      if ( fixed )   {
+	::lib_rtl_output(level,"MonAdder::finish_cycle: updating Output Service %s", this->serviceName.c_str());
+        this->update(cl.get());
+        cl->m_updateStamp = cl->m_reference;
+        if ( this->isSaver && this->saveOnUpdate )  {
+	  auto* p = this->parent;
+          (this->isEOR) ? p->eorSaver->timerHandler() : p->intervalSaver->timerHandler();
         }
-        else    {
-          ::lib_rtl_output(LIB_RTL_INFO,"Data Offset negative or bigger than Record Length for %s %s\n",nam, h->targetService.c_str());
+        if ( this->CycleFn )   {
+	  (*this->CycleFn)(this->CycleArg, *cl->buffer, &cl->monitorItems, this);
+        }
+        if (this->doPause && this->PauseFn )   {
+	  (*this->PauseFn)(this->PauseArg);
         }
       }
-      else     {
-        ::lib_rtl_output(LIB_RTL_INFO,"Bad Name offset %d (%0x) input service %s from %s\n",pp->nameoff,pp->nameoff, isvcd->name.c_str(),h->targetService.c_str());
-      }
-      pp=(DimBuffBase*)AddPtr(pp,pp->reclen);
     }
+    cl->m_added     = 0;
+    cl->m_received  = 0;
+    cl->m_reference = 0;
   }
-  else if (this->currentClass->m_reference == current)  {
-    if (this->debugOn)   {
-      ::lib_rtl_output(LIB_RTL_INFO,"MonAdder %s matching TimeStamps... Adding\n",h->targetService.c_str());
+}
+
+void MonAdder::update(ClassDescriptor* cl)   {
+  if ( this->isSaver )  {
+    if ( this->isLocked )    {
+      this->isLocked = false;
+      this->UnLock();
     }
-    add(buff, siz, h);
   }
-  else  {
-    if (this->debugOn)   {
-      ::lib_rtl_output(LIB_RTL_INFO,
-          "late update from %s\n m_expected %lli received %lli. Using stored buffer...\n",
-          h->targetService.c_str(),this->currentClass->m_reference,current);
+  if ( cl->outputservice )  {
+    cl->outputservice->serialize(-1);
+    cl->outputservice->update();
+    cl->m_updated = true;
+  }
+}
+
+/// Callback to sum up all items of a source frame
+void MonAdder::add_items(ClassDescriptor* clazz, mem_buff& buffer, MonInfo* info)   {
+  int count = 0;
+  MonitorItems  monitor_items;
+  this->load_item_map(monitor_items, buffer);
+  for (const auto& i : monitor_items )  {
+    auto j = clazz->monitorItems.find(i.first);
+    if ( j != clazz->monitorItems.end() )    {
+      auto *summed_item = j->second;
+      auto *source_item = i.second;
+      if ( !offsetinBounds(summed_item,summed_item->reclen,summed_item->dataoff) )      {
+	const std::string& item_name = j->first;
+        ::lib_rtl_output(LIB_RTL_INFO,
+			 "Bad Data offset in sum (first source %s) source %s record %s Loop Record number %d",
+			 clazz->firstSource.c_str(), info->getName(), item_name.c_str(),count);
+        break;
+      }
+      ++count;
+      this->add_item(summed_item, source_item);
     }
-//    printf("late update from %s\n m_expected %lli received %lli. Using stored buffer...\n",h->targetService.c_str(),m_reference,current);
-    add(buff,siz,h);
-//    if (this->test)
-    {
-      this->currentClass->m_received++;
+    else    {
+      clazz->addItem(i.first, i.second);
     }
   }
-  i_update();
+  clazz->m_added++;
 }
 
-void TimeoutCmd::commandHandler()  {
-  ::lib_rtl_output(LIB_RTL_INFO,"Rceived Timeout Command for service %s", this->getName());
-//    printf("Received timeout command Handler called... Calling timeout handler for %s\n", m_adder->name.c_str());
-  m_adder->currentClass = m_adder->classMap->FindClass(getName());
-  m_adder->TimeoutHandler();
+/// Callback to sum up one single item
+void MonAdder::add_item(DimBuffBase* /* summed */, const DimBuffBase* /* source */)  {
 }
diff --git a/Online/GauchoAppl/src/RunManager.cpp b/Online/GauchoAppl/src/RunManager.cpp
index 4a89c846cc13f651cd1939a5ef8e9ec94ca5f7e0..7ce3ccc35cb4112fad7559f194660325310abfa4 100644
--- a/Online/GauchoAppl/src/RunManager.cpp
+++ b/Online/GauchoAppl/src/RunManager.cpp
@@ -12,8 +12,8 @@
 
 #include "GauchoAppl/RunManager.h"
 
-int RunManager::cleanOldest()   {
-  int m=1;
+int Online::RunManager::cleanOldest()   {
+  int m = 1;
   return m;
 }
 
diff --git a/Online/GauchoAppl/src/SaveTimer.cpp b/Online/GauchoAppl/src/SaveTimer.cpp
index d3d212d938039b34ae277deec02e9104b87ad201..b08530fd153f765506ea7ed77516338a9d8bb7c4 100644
--- a/Online/GauchoAppl/src/SaveTimer.cpp
+++ b/Online/GauchoAppl/src/SaveTimer.cpp
@@ -12,7 +12,6 @@
 #include <GauchoAppl/SaveTimer.h>
 #include <Gaucho/ObjService.h>
 #include <Gaucho/SerialHeader.h>
-//#include <Gaucho/MonHist.h>
 #include <Gaucho/RootHists.h>
 #include <Gaucho/Utilities.h>
 #include <GauchoAppl/ClassDescriptor.h>
@@ -29,78 +28,63 @@
 
 using namespace Online;
 
-SaveTimer::SaveTimer(MonAdder *add, int period) 
-  : GenTimer((void*)add,period*1000,TIMER_TYPE_PERIODIC)
+SaveTimer::SaveTimer(std::shared_ptr<MonAdder>& add, int period) 
+  : GenTimer((void*)add.get(),period*1000,TIMER_TYPE_PERIODIC), adder(add)
 {
-  m_adder   = add;
-  m_dueTime = 0;
-  m_EOR     = false;
+  this->m_dueTime = 0;
+  this->EOR     = false;
   TH1D::SetDefaultSumw2();
   TH2D::SetDefaultSumw2();
   TProfile::SetDefaultSumw2();
-  m_dontdimlock = true;
+  this->m_dontdimlock = true;
   ROOT::GetROOT();
   if (!TThread::IsInitialized())  {
     TThread::Initialize();
   }
 }
 
-SaveTimer::~SaveTimer( )
-{
-  m_filenamesvc.reset();
-}
-void SaveTimer::timerHandler(void)
-{
-  m_currFile = 0;
-  if (m_adder)   {
+//#include <mutex>
+void SaveTimer::timerHandler(void)   {
+  //static std::mutex _l;
+  //std::lock_guard<std::mutex> lock(_l);
+  if (this->adder)   {
     // Need protection against m_subsys==0:
     // If the save time runs, but no histograms were
     // ever published, m_subsys (histograms) is NULL!
-    m_adder->Lock();
+    this->adder->Lock();
     if (!m_dontdimlock)
       dim_lock();
     if (!m_dontdimlock)
       dim_unlock();
-    m_adder->UnLock();
-    for (auto i =m_adder->classMap->begin(); i!= m_adder->classMap->end();i++)   {
-      size_t siz = i->second->m_buffersize;
-      if ( siz > 0 )    {
-	if ( m_buffer.first < siz )   {
-	  m_buffer.second.reset(new unsigned char[m_buffer.first=siz]);
+    this->adder->UnLock();
+    auto [m, run] = this->adder->get_class_map("", false);
+    if ( m )   {
+      std::unique_ptr<TFile> output;
+      for (auto& i : *m )   {
+	auto& cl = i.second;
+	if ( cl->buffer->used() > 0 )    {
+	  this->buffer.copy(cl->buffer->begin(), cl->buffer->used());
+	  SerialHeader *hd  = this->buffer.begin<SerialHeader>();
+	  if ( !output && this->buffer.used() >= sizeof(SerialHeader) )     {
+	    makeDirs(hd->run_number);
+	    output = openFile();
+	  }
+	  savetoFile(this->buffer.begin());
 	}
-	::memcpy(m_buffer.second.get(),i->second->m_buffer,siz);
-	SerialHeader *hd  = (SerialHeader *)m_buffer.second.get();
-	unsigned int runo = (unsigned int)hd->run_number;
-	if ( m_currFile == 0 )     {
-	  makeDirs(runo);
-	  openFile();
+	else   {
+	  ::printf("Not writing histograms for %s [No data present]", cl->outputservice->getName());
 	}
-	savetoFile(m_buffer.second.get());
-      }
-      else   {
-	::printf("Not writing histograms for %s [No data present]",
-		 i->second->m_outservname.c_str());
       }
+      closeFile(output);
     }
-    closeFile();
   }
 }
-void SaveTimer::stop()
-{
-  this->GenTimer::stop();
-}
 
-void SaveTimer::setSaveSetService(DimServerDns* dns)
-{
-  m_infoFileStatus = "SAVESETLOCATION/......................................................";
-  if ( !m_filenamesvc )  {
-    std::string infoName = m_partname+"/"+m_taskname+"/SAVESETLOCATION";
-    m_filenamesvc.reset(new DimService(dns, infoName.c_str(),(char*)m_infoFileStatus.c_str()));
-  }
+void SaveTimer::stop()   {
+  this->GenTimer::stop();
 }
 
-void SaveTimer::savetoFile(const void *buff)
-{
+void SaveTimer::savetoFile(const void *buff)    {
   const SerialHeader *hd = (SerialHeader *)buff;
   void *bend = AddPtr(buff,hd->buffersize);
   unsigned int runo = (unsigned int)hd->run_number;
@@ -110,7 +94,7 @@ void SaveTimer::savetoFile(const void *buff)
     loclock = new BRTLLock();
     loclock->m_name = "RootSaverHackLock";
   }
-  if (m_EOR && (runo == 0))
+  if (this->EOR && (runo == 0))
   {
 //    printf("Run Number == 0. No attempt to save....\n");
     return;
@@ -132,9 +116,9 @@ void SaveTimer::savetoFile(const void *buff)
       case H_PROFILE:
       case H_RATE:
       case H_2DPROFILE:     {
-        m_adder->Lock();
+        this->adder->Lock();
 	std::unique_ptr<TH1> r((TH1*)HistSerDes::de_serialize(buff));
-        m_adder->UnLock();
+        this->adder->UnLock();
 	std::unique_ptr<dyn_string> hname(Strsplit(r->GetName(),"/"));
         gDirectory->Cd("/");
         for ( size_t i=0; i < hname->size()-1; i++ )    {
@@ -151,16 +135,16 @@ void SaveTimer::savetoFile(const void *buff)
           case H_PROFILE:
           case H_2DPROFILE:
           case H_RATE:    {
-            m_adder->Lock();
+            this->adder->Lock();
             r->Write(hname->at(hname->size()-1).c_str());
-            m_adder->UnLock();
+            this->adder->UnLock();
             break;
           }
         }
 #if 0
-        m_adder->Lock();
+        this->adder->Lock();
         deletePtr(r.release());
-        m_adder->UnLock();
+        this->adder->UnLock();
 #endif
         prevb = b;
         buff = AddPtr(buff,b->reclen);
@@ -193,10 +177,10 @@ void SaveTimer::makeDirs(int runo)   {
   fn[0] = 0;
   timeval ctim;
   struct tm *tstruct;
-  m_adder->Lock();
+  this->adder->Lock();
   ::gettimeofday(&ctim, NULL);
   tstruct = ::localtime(&ctim.tv_sec);
-  ::snprintf(_root, sizeof(_root), "%s", m_rootdir.c_str());
+  ::snprintf(_root, sizeof(_root), "%s", this->rootdir.c_str());
   ::strncat(fdir, _root, sizeof(fdir) - 1);
   fdir[sizeof(fdir) - 1] = 0;
   ::mkdir(fdir, 01777);
@@ -204,13 +188,13 @@ void SaveTimer::makeDirs(int runo)   {
   ::strncat(fdir, _year, sizeof(fdir) - 1);
   fdir[sizeof(fdir) - 1] = 0;
   ::mkdir(fdir, 01777);
-  if (m_partname != "")   {
-    ::snprintf(_part, sizeof(_part), "/%s", m_partname.c_str());
+  if (partition != "")   {
+    ::snprintf(_part, sizeof(_part), "/%s", partition.c_str());
     ::strncat(fdir, _part, sizeof(fdir) - 1);
     fdir[sizeof(fdir) - 1] = 0;
     ::mkdir(fdir, 01777);
   }
-  ::snprintf(_task, sizeof(_task), "/%s", m_taskname.c_str());
+  ::snprintf(_task, sizeof(_task), "/%s", taskname.c_str());
   strncat(fdir, _task, sizeof(fdir) - 1);
   fdir[sizeof(fdir) - 1] = 0;
   ::mkdir(fdir, 01777);
@@ -222,42 +206,43 @@ void SaveTimer::makeDirs(int runo)   {
   ::strncat(fdir, _day, sizeof(fdir) - 1);
   fdir[sizeof(fdir) - 1] = 0;
   ::mkdir(fdir, 01777);
-  if (!m_EOR)  {
+  if (!this->EOR)  {
     ::snprintf(fn, sizeof(fn), "%s/%s-%d-%4d%02d%02dT%02d%02d%02d.root", fdir,
-	       m_taskname.c_str(), runo, tstruct->tm_year + 1900, tstruct->tm_mon + 1,
+	       taskname.c_str(), runo, tstruct->tm_year + 1900, tstruct->tm_mon + 1,
 	       tstruct->tm_mday, tstruct->tm_hour, tstruct->tm_min, tstruct->tm_sec);
   }
   else    {
     ::snprintf(fn, sizeof(fn), "%s/%s-%d-%4d%02d%02dT%02d%02d%02d-EOR.root",
-	       fdir, m_taskname.c_str(), runo, tstruct->tm_year + 1900,
+	       fdir, taskname.c_str(), runo, tstruct->tm_year + 1900,
 	       tstruct->tm_mon + 1, tstruct->tm_mday, tstruct->tm_hour,
 	       tstruct->tm_min, tstruct->tm_sec);
   }
-  m_currFileName = fn;
-  m_adder->UnLock();
+  this->currFileName = fn;
+  this->adder->UnLock();
 }
 
-void SaveTimer::openFile()  {
-  m_adder->Lock();
-  m_currFile.reset(TFile::Open(m_currFileName.c_str(), "RECREATE"));
-  m_adder->UnLock();
-  if ( !m_currFile )   {
-    printf("Root File %s cannot be opened\n", m_currFileName.c_str());
+std::unique_ptr<TFile> SaveTimer::openFile()  {
+  this->adder->Lock();
+  std::unique_ptr<TFile> file(TFile::Open(this->currFileName.c_str(), "RECREATE"));
+  this->adder->UnLock();
+  if ( !file )   {
+    printf("Root File %s cannot be opened\n", this->currFileName.c_str());
   }
-  else if ( m_currFile->IsZombie())  {
-    printf("Root File %s is Zombie\n", m_currFileName.c_str());
-    m_currFile.reset();
+  else if ( file->IsZombie())  {
+    printf("Root File %s is Zombie\n", this->currFileName.c_str());
+    file.reset();
   }
+  return file;
 }
 
-void SaveTimer::closeFile()   {
-  if ( m_currFile )   {
-    m_adder->Lock();
-    m_currFile->Close();
-    m_currFile.reset();
-    m_adder->UnLock();
-    if ( m_filenamesvc )    {
-      m_filenamesvc->updateService((char*)m_currFileName.c_str());
+void SaveTimer::closeFile(std::unique_ptr<TFile>& file)   {
+  if ( file )   {
+    this->adder->Lock();
+    file->Close();
+    file.reset();
+    this->adder->UnLock();
+    if ( this->savesetSvc )    {
+      this->savesetSvc->updateService((char*)this->currFileName.c_str());
     }
   }
 }
diff --git a/Online/GauchoAppl/src/components/BusyPub.cpp b/Online/GauchoAppl/src/components/BusyPub.cpp
index e51fb94f264e27e0e893c6c7660dbacdf28b2de1..5eb73facfd38919fe3324103af644feff147b983 100644
--- a/Online/GauchoAppl/src/components/BusyPub.cpp
+++ b/Online/GauchoAppl/src/components/BusyPub.cpp
@@ -23,18 +23,15 @@ DECLARE_COMPONENT( BusyPub )
 
 using namespace Online;
 
-StatusCode BusyPub::start()
-{
+StatusCode BusyPub::start()   {
   StatusCode status = PubSvc::start();
   startCycling();
   return status;
 }
 
-StatusCode BusyPub::initialize()
-{
+StatusCode BusyPub::initialize()   {
   StatusCode sc = PubSvc::initialize();
-  if (m_ForcePartition.size() == 0)
-  {
+  if (m_ForcePartition.size() == 0)   {
     this->m_ForcePartition = m_PartitionName;
   }
   if (sc.isSuccess() && m_enableTrending && m_trender == 0)
@@ -91,50 +88,38 @@ void PubDescr::service(DimServerDns *dns)
   }
 }
 
-void BusyPub::analyze(void *, int ,MonMap* mmap)
-{
-  MonMap::iterator i,j,k;
-
+void BusyPub::analyze(mem_buff& ,MonitorItems* mmap)   {
   for (size_t i =0;i<m_PubDescrs.size();i++)
-    m_PubDescrs[i]->service(m_adder->serviceDns());
+    m_PubDescrs[i]->service(this->dns());
 
-  long memtot;
-  long memfree;
-  long memavail;
-  long swaptot;
-  long swapfree;
-  long buffers;
-  double bsy,bogo;
-  int nCores;
-  i = mmap->find("BusySvc/BusyFraction");
+  auto i = mmap->find("BusySvc/BusyFraction");
   if (i == mmap->end()) return;
-  bsy = (CounterSerDes::de_serialize((*i).second))->d_data;
+  double bsy = (CounterSerDes::de_serialize((*i).second))->d_data;
   i = mmap->find("BusySvc/BogoMIPS");
   if (i == mmap->end()) return;
-  bogo = (CounterSerDes::de_serialize((*i).second))->d_data;
+  double bogo = (CounterSerDes::de_serialize((*i).second))->d_data;
   i = mmap->find("BusySvc/NumCores");
   if (i == mmap->end()) return;
-  nCores = (CounterSerDes::de_serialize((*i).second))->i_data;
+  long nCores = (CounterSerDes::de_serialize((*i).second))->i_data;
   i = mmap->find("BusySvc/TotMemory");
-  memtot = (CounterSerDes::de_serialize((*i).second))->l_data;
+  long memtot = (CounterSerDes::de_serialize((*i).second))->l_data;
   i = mmap->find("BusySvc/MemAvail");
-  memavail = (CounterSerDes::de_serialize((*i).second))->l_data;
+  long memavail = (CounterSerDes::de_serialize((*i).second))->l_data;
   i = mmap->find("BusySvc/FreeMemory");
-  memfree = (CounterSerDes::de_serialize((*i).second))->l_data;
+  long memfree = (CounterSerDes::de_serialize((*i).second))->l_data;
   i = mmap->find("BusySvc/SwapSpaceTot");
-  swaptot = (CounterSerDes::de_serialize((*i).second))->l_data;
+  long swaptot = (CounterSerDes::de_serialize((*i).second))->l_data;
   i = mmap->find("BusySvc/SwapSpaceFree");
-  swapfree = (CounterSerDes::de_serialize((*i).second))->l_data;
+  long swapfree = (CounterSerDes::de_serialize((*i).second))->l_data;
   i = mmap->find("BusySvc/MemBuffers");
-  buffers = (CounterSerDes::de_serialize((*i).second))->l_data;
+  long buffers = (CounterSerDes::de_serialize((*i).second))->l_data;
   m_PubDescrs[0]->m_outbuff = float(bsy/bogo);m_PubDescrs[0]->update();
   m_PubDescrs[1]->m_outbuff = 1.0-(float(memfree)/float(memtot));m_PubDescrs[1]->update();
   m_PubDescrs[2]->m_outbuff = (float(buffers)/float(memtot));m_PubDescrs[2]->update();
   m_PubDescrs[3]->m_outbuff = 1.0-(float(swapfree)/float(swaptot));m_PubDescrs[3]->update();
   m_PubDescrs[4]->m_outbuff = float(nCores);m_PubDescrs[4]->update();
   m_PubDescrs[5]->m_outbuff = (float(memavail)/float(memtot));m_PubDescrs[5]->update();
-  for (size_t cli= 0;cli<m_NodeClasses.size();cli++)
-  {
+  for (size_t cli= 0;cli<m_NodeClasses.size();cli++)  {
     i = mmap->find("BusySvc/"+m_NodeClasses[cli]+"/BusyFraction");
     if (i == mmap->end()) continue;
     bsy = (CounterSerDes::de_serialize((*i).second))->d_data;
@@ -168,8 +153,7 @@ void BusyPub::analyze(void *, int ,MonMap* mmap)
   }
 }
 
-BusyPub::BusyPub(const std::string& name, ISvcLocator* sl) : PubSvc(name,sl)
-{
+BusyPub::BusyPub(const std::string& name, ISvcLocator* sl) : PubSvc(name,sl)   {
   declareProperty("TrendingOn",  m_enableTrending=false);
   declareProperty("ForcePartition",  m_ForcePartition="");
   declareProperty("GlobalPublisher",m_GlobalPublisher=false);
diff --git a/Online/GauchoAppl/src/components/BusyPub.h b/Online/GauchoAppl/src/components/BusyPub.h
index d23af4f05f3d3c67383df9ede5e38195cca49b60..8c0fe2d86a76100926e721299574e3e2ddd786f4 100644
--- a/Online/GauchoAppl/src/components/BusyPub.h
+++ b/Online/GauchoAppl/src/components/BusyPub.h
@@ -23,7 +23,6 @@
 class DimService;
 class DimServerDns;
 
-
 class PubDescr  {
   public:
     PubDescr(std::string insrv, std::string outsrv);
@@ -43,7 +42,7 @@ class BusyPub: public PubSvc
     virtual ~BusyPub() = default;
     StatusCode start() override;
     StatusCode initialize() override;
-    void analyze(void *buff, int siz, Online::MonMap* mmap)   override;
+    void analyze(mem_buff& buffer, Online::MonitorItems* mmap)   override;
     bool m_enableTrending;
     DimService *m_FarmLoad;
     DimService *m_Cores;
diff --git a/Online/GauchoAppl/src/components/BusySvc.cpp b/Online/GauchoAppl/src/components/BusySvc.cpp
index f8de1df8450039f972f7ad0fbdd08165c837f708..05ec6472b13f091e71779c645393b1009af7217f 100644
--- a/Online/GauchoAppl/src/components/BusySvc.cpp
+++ b/Online/GauchoAppl/src/components/BusySvc.cpp
@@ -16,19 +16,15 @@
 
 DECLARE_COMPONENT( BusySvc )
 
-void IdleTimer::timerHandler(void)
-{
+void IdleTimer::timerHandler(void)   {
   m_bsysvc->calcIdle();
 }
 
-IdleTimer::~IdleTimer()
-{
-
+IdleTimer::~IdleTimer()   {
 }
-StatusCode BusySvc::initialize()
-{
-  StatusCode sc;
-  sc = Service::initialize();
+
+StatusCode BusySvc::initialize()   {
+  StatusCode sc = Service::initialize();
   if( !sc.isSuccess() )  {
     return StatusCode::FAILURE;
   }
diff --git a/Online/GauchoAppl/src/components/CntrPub.cpp b/Online/GauchoAppl/src/components/CntrPub.cpp
index 671669868ee2b612f5160b5bf494611ac7689166..00f20e3c00d95c4ef365aa0b1ab37dde54c48d97 100644
--- a/Online/GauchoAppl/src/components/CntrPub.cpp
+++ b/Online/GauchoAppl/src/components/CntrPub.cpp
@@ -44,35 +44,28 @@ StatusCode CntrPub::finalize()   {
   return this->PubSvc::finalize();
 }
 
-void CntrPub::analyze(void *, int, Online::MonMap* mmap)
+void CntrPub::analyze(mem_buff&, Online::MonitorItems* mmap)
 {
-  if (this->m_enableTrending)
-  {
+  if (this->m_enableTrending)  {
     this->m_trender->startEvent();
   }
-
-  for ( auto& it : *mmap )
-  {
+  for ( auto& it : *mmap )  {
     bool status = boost::regex_search(it.first, m_counterPatternRegex);
-    if (status)
-    {
+    if (status)    {
       SVCDescr *sdes { nullptr };
       auto mit = m_cntrSvcMap.find(it.first);
-      if (mit == m_cntrSvcMap.end())
-      {
+      if (mit == m_cntrSvcMap.end())      {
         std::string svcnam = it.first;
         sdes = new SVCDescr;
 
-        if (svcnam.find("R_",0,2) != std::string::npos)
-        {
+        if (svcnam.find("R_",0,2) != std::string::npos)        {
           sdes->name = "stat/"+m_PartitionName+"_x_"+svcnam.substr(2,std::string::npos)+"/Rate";
-          sdes->svc = new DimService(m_adder->serviceDns(), (char*) sdes->name.c_str(),sdes->rdata);
+          sdes->svc = new DimService(this->dns(), (char*) sdes->name.c_str(),sdes->rdata);
           sdes->type = 1;
         }
-        else
-        {
+        else        {
           sdes->name = "stat/"+m_PartitionName+"_x_"+svcnam+"/Count";
-          sdes->svc = new DimService(m_adder->serviceDns(), (char*) sdes->name.c_str(),sdes->idata);
+          sdes->svc = new DimService(this->dns(), (char*) sdes->name.c_str(),sdes->idata);
           sdes->type = 0;
         }
         m_cntrSvcMap.insert(std::make_pair(svcnam,sdes));
diff --git a/Online/GauchoAppl/src/components/CntrPub.h b/Online/GauchoAppl/src/components/CntrPub.h
index 93503e03199ed56a815d22d6484491fb7450e5cb..5e556a9766e0da21e98240c2f57b4b8d82652850 100644
--- a/Online/GauchoAppl/src/components/CntrPub.h
+++ b/Online/GauchoAppl/src/components/CntrPub.h
@@ -36,7 +36,7 @@ public:
   virtual StatusCode start() override;
   virtual StatusCode initialize() override;
   virtual StatusCode finalize() override;
-  virtual void analyze(void *buff, int siz, Online::MonMap* mmap)  override;
+  virtual void analyze(mem_buff& buffer, Online::MonitorItems* mmap)  override;
 
   boost::regex m_counterPatternRegex;
   std::string m_SvcInfix;
diff --git a/Online/GauchoAppl/src/components/DiskWrPub.cpp b/Online/GauchoAppl/src/components/DiskWrPub.cpp
index 6ba0b1b905cf6fd8a29602b4362d99907c843d02..e51b2df197869b94d7d127d0197dd6299c6e21ac 100644
--- a/Online/GauchoAppl/src/components/DiskWrPub.cpp
+++ b/Online/GauchoAppl/src/components/DiskWrPub.cpp
@@ -10,13 +10,7 @@
 //
 //==========================================================================
 #include "DiskWrPub.h"
-#include "GaudiKernel/SmartIF.h"
 #include "GaudiKernel/IIncidentSvc.h"
-//#include "GaudiKernel/IHistogramSvc.h"
-
-//#include "GauchoAppl/HistAdder.h"
-//#include "GauchoAppl/CounterAdder.h"
-//#include "GauchoAppl/SaveTimer.h"
 #include "GauchoAppl/AdderSys.h"
 #include "Gaucho/Utilities.h"
 #include "Gaucho/IGauchoMonitorSvc.h"
@@ -47,23 +41,22 @@ StatusCode DiskWrPub::finalize()   {
 }
 
 
-void DiskWrPub::analyze(void *, int ,MonMap* mmap)
+void DiskWrPub::analyze(mem_buff& ,MonitorItems* mmap)
 {
-  MonMap::iterator i,j,k,l;
-  i = mmap->find("R_EventSelector/EventsReq");
+  auto i = mmap->find("R_EventSelector/EventsReq");
   if (i == mmap->end()) return;
-  j = mmap->find("R_Runable/EvtCount");
+  auto j = mmap->find("R_Runable/EvtCount");
   if (j == mmap->end()) return;
-  k = mmap->find("R_SND_0/EventsOut");
+  auto k = mmap->find("R_SND_0/EventsOut");
   if (k == mmap->end()) return;
-  l = mmap->find("R_SND_0/BytesOut");
+  auto l = mmap->find("R_SND_0/BytesOut");
   if (k == mmap->end()) return;
-  double evreq,evcount,evout,bout;
+
 //  double RMeps;
-  evreq = (CounterSerDes::de_serialize((*i).second))->d_data;
-  evcount = (CounterSerDes::de_serialize((*j).second))->d_data;
-  evout = (CounterSerDes::de_serialize((*k).second))->d_data;
-  bout =  (CounterSerDes::de_serialize((*l).second))->d_data;
+  double evreq   = (CounterSerDes::de_serialize((*i).second))->d_data;
+  double evcount = (CounterSerDes::de_serialize((*j).second))->d_data;
+  double evout   = (CounterSerDes::de_serialize((*k).second))->d_data;
+  double bout    =  (CounterSerDes::de_serialize((*l).second))->d_data;
 //  m_NoBytes = float(double(bout)/1.0e09);
 //  m_NoFiles = NFiles;
 //  m_NoMEPs  = NMEPs;
@@ -84,8 +77,7 @@ void DiskWrPub::analyze(void *, int ,MonMap* mmap)
 //  }
 //  m_NoMEPsSvc->updateService(m_NoMEPs);
 
-  if (m_enableTrending)
-  {
+  if (m_enableTrending)  {
     m_trender->startEvent();
     m_trender->addEntry("Diskwr Events Requested", evreq);
     m_trender->addEntry("Diskwr Events Processed", evcount);
diff --git a/Online/GauchoAppl/src/components/DiskWrPub.h b/Online/GauchoAppl/src/components/DiskWrPub.h
index 8fbfdbc543367e24ac71292dc2a52be6b0a3b5e6..26224b10bbde0bc1a1461d31c8e78c242f5bba55 100644
--- a/Online/GauchoAppl/src/components/DiskWrPub.h
+++ b/Online/GauchoAppl/src/components/DiskWrPub.h
@@ -25,7 +25,7 @@ public:
   StatusCode start() override;
   StatusCode initialize() override;
   StatusCode finalize() override;
-  virtual void analyze(void *buff, int siz, Online::MonMap* mmap)  override;
+  virtual void analyze(mem_buff& buffer, Online::MonitorItems* mmap)  override;
 
   bool m_enableTrending;
   DimService *m_NoBytesSvc;
diff --git a/Online/GauchoAppl/src/components/EvtsPub.cpp b/Online/GauchoAppl/src/components/EvtsPub.cpp
index da12fae0b97d69df14ab8cc122c6f5955041346a..a8761422e6d1c5717ed7d9d733a2ffb7f7eb962c 100644
--- a/Online/GauchoAppl/src/components/EvtsPub.cpp
+++ b/Online/GauchoAppl/src/components/EvtsPub.cpp
@@ -36,10 +36,10 @@ StatusCode EvtsPub::initialize()
   return sc;
 }
 
-void EvtsPub::analyze(void *, int ,MonMap* mmap)
+void EvtsPub::analyze(mem_buff& ,MonitorItems* mmap)
 {
-  MonMap::iterator evtCnt, evtRate;
-//  MonMap::iterator  it;
+  MonitorItems::iterator evtCnt, evtRate;
+//  MonitorItems::iterator  it;
 //  printf("dumping Map\n");
 //  for (it=mmap->begin();it!=mmap->end();it++)
 //  {d
@@ -73,7 +73,7 @@ void EvtsPub::analyze(void *, int ,MonMap* mmap)
       svc = ds1[ds1.size()-2]+"_"+ds1[ds1.size()-1];
       delete &ds1;
       nam = m_PartitionName+"_X_"+svc+"/Runable/EvtCount";
-      m_noEvtsSvc = new DimService(m_adder->serviceDns(),(char*)nam.c_str(),m_NoEvts);
+      m_noEvtsSvc = new DimService(this->dns(),(char*)nam.c_str(),m_NoEvts);
     }
     m_noEvtsSvc->updateService(m_NoEvts);
   }
@@ -95,7 +95,7 @@ void EvtsPub::analyze(void *, int ,MonMap* mmap)
       svc = ds1[ds1.size()-2]+"_"+ds1[ds1.size()-1];
       delete &ds1;
       std::string nam = m_PartitionName+"_X_"+svc+"/R_Runable/EvtCount";
-      m_EvtRateSvc = new DimService(m_adder->serviceDns(),(char*)nam.c_str(),m_EvtRate);
+      m_EvtRateSvc = new DimService(this->dns(),(char*)nam.c_str(),m_EvtRate);
     }
     m_EvtRateSvc->updateService(m_EvtRate);
   }
diff --git a/Online/GauchoAppl/src/components/EvtsPub.h b/Online/GauchoAppl/src/components/EvtsPub.h
index 94a87f1dbdffb0af74b26c29ec17d54bc09d2437..bdabf5e7ba2453713f8bfc68b29576e6abd4d684 100644
--- a/Online/GauchoAppl/src/components/EvtsPub.h
+++ b/Online/GauchoAppl/src/components/EvtsPub.h
@@ -28,7 +28,7 @@ public:
   virtual ~EvtsPub() = default;
   StatusCode start() override;
   StatusCode initialize() override;
-  void analyze(void *buff, int siz, Online::MonMap* mmap)  override;
+  void analyze(mem_buff& buffer, Online::MonitorItems* mmap)  override;
   bool m_enableTrending;
 
   DimService *m_noEvtsSvc {nullptr};
diff --git a/Online/GauchoAppl/src/components/GenStatSvc.cpp b/Online/GauchoAppl/src/components/GenStatSvc.cpp
index 8531798e429eb42e407708195aac3f57d7123a78..d00fc1453f2e55427b76290b048fd9dd899d3f70 100644
--- a/Online/GauchoAppl/src/components/GenStatSvc.cpp
+++ b/Online/GauchoAppl/src/components/GenStatSvc.cpp
@@ -39,7 +39,7 @@ StatusCode GenStatSvc::start()  {
   return sc;
 }
 
-void GenStatSvc::analyze(void *, int ,MonMap* mmap)  {
+void GenStatSvc::analyze(mem_buff& ,MonitorItems* mmap)  {
   for ( const auto& it : *mmap )  {
     DimBuffBase *buff = (DimBuffBase*)it.second;
     switch(buff->type)    {
diff --git a/Online/GauchoAppl/src/components/GenStatSvc.h b/Online/GauchoAppl/src/components/GenStatSvc.h
index afacb8584cd4b4afd821e5ca72f31c1a153817d7..f6798b49e03f5bac9d4ff684ddbcc41ff0c2b685 100644
--- a/Online/GauchoAppl/src/components/GenStatSvc.h
+++ b/Online/GauchoAppl/src/components/GenStatSvc.h
@@ -12,7 +12,7 @@
 #ifndef ONLINE_GAUCHO_GENSTATSVC_H
 #define ONLINE_GAUCHO_GENSTATSVC_H
 
-#include "GauchoAppl/COutService.h"
+#include <GauchoAppl/COutService.h>
 #include "PubSvc.h"
 
 // Forward declarations
@@ -25,6 +25,6 @@ public:
   GenStatSvc(const std::string& name, ISvcLocator* svcloc);
   virtual ~GenStatSvc();
   StatusCode start() override;
-  void analyze(void *buff, int size, Online::MonMap* mmap)  override;
+  void analyze(mem_buff& buffer, Online::MonitorItems* mmap)  override;
 };
 #endif // ONLINE_GAUCHO_GENSTATSVC_H
diff --git a/Online/GauchoAppl/src/components/MEPSvc.cpp b/Online/GauchoAppl/src/components/MEPSvc.cpp
index 5a78f5ec3925d875f7a0643fbf310a83b36a020f..65e1204e33f6e9f62c13ab02fd5858b9c23cdfdf 100644
--- a/Online/GauchoAppl/src/components/MEPSvc.cpp
+++ b/Online/GauchoAppl/src/components/MEPSvc.cpp
@@ -46,7 +46,7 @@ Tell1Stats::Tell1Stats(std::vector<std::string> &TellList): m_CSvc(0),m_RSvc(0)
     compList.push_back(s_counterTypes[i]);
   }
 }
-void Tell1Stats::fillBuffers(MonMap *mmap)
+void Tell1Stats::fillBuffers(MonitorItems *mmap)
 {
   ::memset(m_LossRate,0,m_nents*sizeof(float));
   ::memset(m_LossCount,0,m_nents*sizeof(unsigned int));
@@ -99,13 +99,13 @@ void Tell1Stats::Update()
   m_RSvc->updateService(m_LossRate,m_nents*sizeof(float));
 }
 
-void MEPSvc::filldata(const std::string &cnam,MonMap *mmap)
+void MEPSvc::filldata(const std::string &cnam,MonitorItems *mmap)
 {
   filldata("Runable/",cnam,mmap);
 }
-void MEPSvc::filldata(const std::string &prefix,const std::string &cnam,MonMap *mmap)
+void MEPSvc::filldata(const std::string &prefix,const std::string &cnam,MonitorItems *mmap)
 {
-  MonMap::iterator it;
+  MonitorItems::iterator it;
   DetData_T<long long>& lb = m_DetMap.find("LHCb")->second;
   it = mmap->find(prefix+cnam);
   if ( it != mmap->end() )
@@ -134,9 +134,9 @@ void MEPSvc::filldata(const std::string &prefix,const std::string &cnam,MonMap *
     }
   }
 }
-void MEPSvc::fillrate(const std::string &prefix,const std::string &cnam,MonMap *mmap)
+void MEPSvc::fillrate(const std::string &prefix,const std::string &cnam,MonitorItems *mmap)
 {
-  MonMap::iterator it;
+  MonitorItems::iterator it;
   DetData_T<double>& lb = m_DetMap_rate.find("LHCb")->second;
   it = mmap->find(prefix+cnam);
   if ( it != mmap->end() )
@@ -167,7 +167,7 @@ void MEPSvc::fillrate(const std::string &prefix,const std::string &cnam,MonMap *
     }
   }
 }
-void MEPSvc::fillMEPLossRate(MonMap *mmap)
+void MEPSvc::fillMEPLossRate(MonitorItems *mmap)
 {
   m_LossMepLine.clear();
   for( auto it = mmap->begin();it != mmap->end();it++)
@@ -187,7 +187,7 @@ void MEPSvc::fillMEPLossRate(MonMap *mmap)
   }
   if (m_LossMepSvc == 0)
   {
-    m_LossMepSvc = new DimService(m_adder->serviceDns(),(char*)(this->m_PartitionName+"_FarmLostMep").c_str(),"C",(void*)"",0);
+    m_LossMepSvc = new DimService(this->dns(),(char*)(this->m_PartitionName+"_FarmLostMep").c_str(),"C",(void*)"",0);
   }
   m_LossMepLine.append("\0");
   m_LossMepSvc->updateService((void*)m_LossMepLine.c_str(),m_LossMepLine.size()+1);
@@ -238,22 +238,22 @@ StatusCode MEPSvc::start()
   if (m_Tell1Service ==0)
   {
     std::string nam = "Stat/"+m_myservicename+"/Tell1/NameList";
-    m_Tell1Service = new TellService(nam,m_TellNames,m_adder->serviceDns());
+    m_Tell1Service = new TellService(nam,m_TellNames,this->dns());
   }
   m_DetMap_old = m_DetMap;
   this->m_DetMap_rate.setServiceName("Stat/"+m_myservicename+"/Rate");
   this->m_DetMap.setServiceName("Stat/"+m_myservicename+"/Count");
   startCycling();
   m_Tell1Service->Update();
-  m_Tell1Stats->makeServices("Stat/"+m_myservicename+"/",m_adder->serviceDns());
+  m_Tell1Stats->makeServices("Stat/"+m_myservicename+"/",this->dns());
   return StatusCode::SUCCESS;
 }
 
-void MEPSvc::analyze(void *, int ,MonMap* mmap)
+void MEPSvc::analyze(mem_buff& ,MonitorItems* mmap)
 {
   m_DetMap.Zero();
   m_DetMap_rate.Zero();
-  MonMap::iterator Meptotit,MepOvrit,MepMooreit;
+  MonitorItems::iterator Meptotit,MepOvrit,MepMooreit;
   Meptotit = mmap->find("R_Runable/totMEPproduced");
   MepOvrit = mmap->find("R_Runable/totMEPproducedOvfl");
   MepMooreit = mmap->find("R_Runable/totMEPproducedLive");
@@ -284,11 +284,11 @@ void MEPSvc::analyze(void *, int ,MonMap* mmap)
     fillrate(std::string("R_Runable/"),s_counterTypes[i],mmap);
   }
   this->fillsums();
-  m_DetMap.setDNS(m_adder->serviceDns());
+  m_DetMap.setDNS(this->dns());
   m_DetMap.Update();
 //  m_DetMap.dump();
 //  m_DetMap_rate.dump();
-  m_DetMap_rate.setDNS(m_adder->serviceDns());
+  m_DetMap_rate.setDNS(this->dns());
   m_DetMap_rate.Update();
   DetMap_T<double>::iterator ii = m_DetMap_rate.find(m_PartitionName/*"LHCb"*/);
   if (ii!=m_DetMap_rate.end())
@@ -299,7 +299,7 @@ void MEPSvc::analyze(void *, int ,MonMap* mmap)
       m_DataRate = (float)jj->second;
       if (m_LHCbDataRate == 0)
       {
-        m_LHCbDataRate = new DimService(m_adder->serviceDns(),(char*)(m_PartitionName+"_DataRate").c_str(),m_DataRate);
+        m_LHCbDataRate = new DimService(this->dns(),(char*)(m_PartitionName+"_DataRate").c_str(),m_DataRate);
       }
       m_LHCbDataRate->updateService(m_DataRate);
 //      printf("%s Total Data Rate %f\n",m_PartitionName.c_str(),m_DataRate);
@@ -333,12 +333,12 @@ void MEPSvc::analyze(void *, int ,MonMap* mmap)
   m_MEPDeferred = Mepsovr;
   if (m_MEPTotRateSvc == 0)
   {
-    m_MEPTotRateSvc = new DimService(m_adder->serviceDns(),(char*)(m_PartitionName+"_InputMEPRate").c_str(),m_MEPRate);
+    m_MEPTotRateSvc = new DimService(this->dns(),(char*)(m_PartitionName+"_InputMEPRate").c_str(),m_MEPRate);
   }
   m_MEPTotRateSvc->updateService(m_MEPRate);
   if (m_MEPDefRateSvc == 0)
   {
-    m_MEPDefRateSvc = new DimService(m_adder->serviceDns(),(char*)(m_PartitionName+"_DeferMEPRate").c_str(),m_MEPDeferred);
+    m_MEPDefRateSvc = new DimService(this->dns(),(char*)(m_PartitionName+"_DeferMEPRate").c_str(),m_MEPDeferred);
   }
   m_MEPDefRateSvc->updateService(m_MEPDeferred);
   this->fillMEPLossRate(mmap);
diff --git a/Online/GauchoAppl/src/components/MEPSvc.h b/Online/GauchoAppl/src/components/MEPSvc.h
index 6ed4ca75b5248833fe1df5a4637853b36334231e..ddd5a6287e689ba64a131abcb5415276ca4ad15f 100644
--- a/Online/GauchoAppl/src/components/MEPSvc.h
+++ b/Online/GauchoAppl/src/components/MEPSvc.h
@@ -484,7 +484,7 @@ class Tell1Stats
     std::string m_RName;
     std::vector<std::string> compList;
     Tell1Stats(std::vector<std::string> &TellList);
-    void fillBuffers(Online::MonMap *mmap);
+    void fillBuffers(Online::MonitorItems *mmap);
     void makeServices(std::string prefix,DimServerDns *dns=0);
     void Update();
 };
@@ -519,11 +519,11 @@ public:
   std::string m_LossMepLine;
   DimService *m_LossMepSvc;
   void fillTellMap ();
-  void analyze(void *buff, int siz,Online::MonMap* mmap)  override;
-  void filldata(const std::string &cnam,Online::MonMap *mmap);
-  void filldata(const std::string &prefix,const std::string &cnam,Online::MonMap *mmap);
-  void fillrate(const std::string &prefix,const std::string &cnam,Online::MonMap *mmap);
-  void fillMEPLossRate(Online::MonMap *mmap);
+  void analyze(mem_buff& buffer, Online::MonitorItems* mmap)  override;
+  void filldata(const std::string &cnam,Online::MonitorItems *mmap);
+  void filldata(const std::string &prefix,const std::string &cnam,Online::MonitorItems *mmap);
+  void fillrate(const std::string &prefix,const std::string &cnam,Online::MonitorItems *mmap);
+  void fillMEPLossRate(Online::MonitorItems *mmap);
   void dump();
   void fillsums();
   std::vector<std::string> m_tell1List;
diff --git a/Online/GauchoAppl/src/components/MEPrxThrottleSvc.cpp b/Online/GauchoAppl/src/components/MEPrxThrottleSvc.cpp
index fae005450a3ce907f7d026fb07fc5027e87b6928..afe8f59afa9396303941dd13e749db33a7554be3 100644
--- a/Online/GauchoAppl/src/components/MEPrxThrottleSvc.cpp
+++ b/Online/GauchoAppl/src/components/MEPrxThrottleSvc.cpp
@@ -31,10 +31,9 @@ using namespace Online;
 
 namespace MEPRXTHROTTLESVC
 {
-  void Analyze(void *arg, void* buff ,int siz, MonMap *mmap, MonAdder *)
-  {
+  void Analyze(void *arg, mem_buff& buff, MonitorItems *mmap, MonAdder *)  {
     MEPrxThrottleSvc *tis = (MEPrxThrottleSvc*)arg;
-    tis->analyze(buff,siz, mmap);
+    tis->analyze(buff, mmap);
   }
 }
 
@@ -64,7 +63,7 @@ public:
   }
 };
 
-void MEPrxThrottleSvc::fillMEPThrottleCnt(MonMap *mmap)
+void MEPrxThrottleSvc::fillMEPThrottleCnt(MonitorItems *mmap)
 {
   m_MepthrottleLine.clear();
   for( auto it = mmap->begin();it != mmap->end();it++)
@@ -84,7 +83,7 @@ void MEPrxThrottleSvc::fillMEPThrottleCnt(MonMap *mmap)
   }
   if (m_MepthrottleSvc == 0)
   {
-    DimServerDns *dns=m_adder->serviceDns();
+    DimServerDns *dns=this->dns();
 //    dns->clearName();
 //    DimServer::start(dns,"Beat");
     m_MepthrottleSvc = new DimService(dns,(char*)(this->m_PartitionName+"_MepthrottleCnt").c_str(),"C",(void*)Empty,1);
@@ -142,7 +141,7 @@ StatusCode MEPrxThrottleSvc::start()
   m_adder->SetCycleFn(MEPRXTHROTTLESVC::Analyze,this);
   return StatusCode::SUCCESS;
 }
-void MEPrxThrottleSvc::analyze(void *, int ,MonMap* mmap)
+void MEPrxThrottleSvc::analyze(mem_buff&, MonitorItems* mmap)
 {
   this->fillMEPThrottleCnt(mmap);
 }
@@ -164,13 +163,9 @@ MEPrxThrottleSvc::~MEPrxThrottleSvc()
 StatusCode MEPrxThrottleSvc::queryInterface(const InterfaceID& riid, void** ppvIF)
 {
   if ( IIncidentListener::interfaceID().versionMatch(riid) )
-  {
     *ppvIF = (IIncidentListener*)this;
-  }
   else
-  {
     return Service::queryInterface(riid, ppvIF);
-  }
   addRef();
   return StatusCode::SUCCESS;
 }
diff --git a/Online/GauchoAppl/src/components/MEPrxThrottleSvc.h b/Online/GauchoAppl/src/components/MEPrxThrottleSvc.h
index 908c55e63b74b9ec3200d75ac795e97396c0b93a..f3dbbfda6c85b697f8936aaa8aaac5a3bc7bea1f 100644
--- a/Online/GauchoAppl/src/components/MEPrxThrottleSvc.h
+++ b/Online/GauchoAppl/src/components/MEPrxThrottleSvc.h
@@ -36,8 +36,8 @@ public:
   StatusCode queryInterface(const InterfaceID& riid, void** ppvIF)  override;
   StatusCode initialize()  override;
   StatusCode start()  override;
-  void analyze(void *buff, int siz, Online::MonMap* mmap) override;
-  void fillMEPThrottleCnt(Online::MonMap *mmap);
+  void analyze(mem_buff& buffer, Online::MonitorItems* mmap) override;
+  void fillMEPThrottleCnt(Online::MonitorItems *mmap);
   void dump();
   StatusCode finalize()  override;
 };
diff --git a/Online/GauchoAppl/src/components/MoorePub.cpp b/Online/GauchoAppl/src/components/MoorePub.cpp
index c3ce60772c0b817ad3ca52bda8d701c4748a4fb6..00c8680bc67fb3469b53bfdf870b640198f5c779 100644
--- a/Online/GauchoAppl/src/components/MoorePub.cpp
+++ b/Online/GauchoAppl/src/components/MoorePub.cpp
@@ -26,7 +26,7 @@ public:
   virtual ~MoorePub() = default;
   virtual StatusCode start() override;
   virtual StatusCode initialize() override;
-  virtual void analyze(void *buff, int siz,Online::MonMap* mmap)  override;
+  virtual void analyze(mem_buff& buffer,Online::MonitorItems* mmap)  override;
 };
 
 DECLARE_COMPONENT( MoorePub )
@@ -51,12 +51,12 @@ StatusCode MoorePub::initialize()
   return sc;
 }
 
-void MoorePub::analyze(void *, int , Online::MonMap* mmap)   {
+void MoorePub::analyze(mem_buff&, Online::MonitorItems* mmap)   {
   auto i = mmap->find("UpdateAndReset/Tasks");
   auto* tsk_d = Online::CounterSerDes::de_serialize((*i).second);
   m_NoMoores = tsk_d->i_data;
   if (m_MooreSvc == 0)  {
-    m_MooreSvc = new DimService(m_adder->serviceDns(),(char*)(m_PartitionName+"/"+m_TrendName).c_str(),m_NoMoores);
+    m_MooreSvc = new DimService(this->dns(),(char*)(m_PartitionName+"/"+m_TrendName).c_str(),m_NoMoores);
   }
   m_MooreSvc->updateService(m_NoMoores);
   if (m_enableTrending)    {
diff --git a/Online/GauchoAppl/src/components/OvrPub.cpp b/Online/GauchoAppl/src/components/OvrPub.cpp
index 98a411bc92814293f407ab0a257bd08899970831..32e5037777e2f23cc0f3f5211f0488a970435ebc 100644
--- a/Online/GauchoAppl/src/components/OvrPub.cpp
+++ b/Online/GauchoAppl/src/components/OvrPub.cpp
@@ -33,14 +33,14 @@ StatusCode OvrPub::initialize()   {
   return sc;
 }
 
-void OvrPub::analyze(void *, int ,MonMap* mmap)    {
-  MonMap::iterator i = mmap->find("OverflowWr/BytesOut");
+void OvrPub::analyze(mem_buff& ,MonitorItems* mmap)    {
+  MonitorItems::iterator i = mmap->find("OverflowWr/BytesOut");
   if (i == mmap->end()) return;
-  MonMap::iterator j = mmap->find("OverflowWr/NumberofFiles");
+  MonitorItems::iterator j = mmap->find("OverflowWr/NumberofFiles");
   if (j == mmap->end()) return;
-  MonMap::iterator k = mmap->find("OverflowWr/MEPsOut");
+  MonitorItems::iterator k = mmap->find("OverflowWr/MEPsOut");
   if (k == mmap->end()) return;
-  MonMap::iterator MEPRate = mmap->find("R_OverflowWr/MEPsOut");
+  MonitorItems::iterator MEPRate = mmap->find("R_OverflowWr/MEPsOut");
   if (MEPRate == mmap->end()) return;
   long long BOut,NFiles,NMEPs;
   double RMeps;
@@ -54,17 +54,17 @@ void OvrPub::analyze(void *, int ,MonMap* mmap)    {
   m_MEPRate = RMeps;
   if (m_NoBytesSvc == 0)
   {
-    m_NoBytesSvc = new DimService(m_adder->serviceDns(),(char*)(std::string("Stat/")+m_PartitionName+"_X_Overflow/NoBytes").c_str(),m_NoBytes);
+    m_NoBytesSvc = new DimService(this->dns(),(char*)(std::string("Stat/")+m_PartitionName+"_X_Overflow/NoBytes").c_str(),m_NoBytes);
   }
   m_NoBytesSvc->updateService(m_NoBytes);
   if (m_NoFilesSvc == 0)
   {
-    m_NoFilesSvc = new DimService(m_adder->serviceDns(),(char*)(std::string("Stat/")+m_PartitionName+"_X_Overflow/NoFiles").c_str(),m_NoFiles);
+    m_NoFilesSvc = new DimService(this->dns(),(char*)(std::string("Stat/")+m_PartitionName+"_X_Overflow/NoFiles").c_str(),m_NoFiles);
   }
   m_NoFilesSvc->updateService(m_NoFiles);
   if (m_NoMEPsSvc == 0)
   {
-    m_NoMEPsSvc = new DimService(m_adder->serviceDns(),(char*)(std::string("Stat/")+m_PartitionName+"_X_Overflow/NoMEPs").c_str(),m_NoMEPs);
+    m_NoMEPsSvc = new DimService(this->dns(),(char*)(std::string("Stat/")+m_PartitionName+"_X_Overflow/NoMEPs").c_str(),m_NoMEPs);
   }
   m_NoMEPsSvc->updateService(m_NoMEPs);
 
diff --git a/Online/GauchoAppl/src/components/OvrPub.h b/Online/GauchoAppl/src/components/OvrPub.h
index cc82a296fd331b4b98b539ca8f7dcf6275d3163f..e69b061c3935cf248ff989af1c0dbace68ef41b7 100644
--- a/Online/GauchoAppl/src/components/OvrPub.h
+++ b/Online/GauchoAppl/src/components/OvrPub.h
@@ -24,7 +24,7 @@ public:
   virtual ~OvrPub() = default;
   StatusCode start() override;
   StatusCode initialize() override;
-  void analyze(void *buff, int siz, Online::MonMap* mmap)  override;
+  void analyze(mem_buff& buffer, Online::MonitorItems* mmap)  override;
 
   DimService *m_NoBytesSvc  {nullptr};
   DimService *m_NoFilesSvc  {nullptr};
diff --git a/Online/GauchoAppl/src/components/PubSvc.cpp b/Online/GauchoAppl/src/components/PubSvc.cpp
index 4895881a6ef882c9b24d086267f31de2e0f743ca..866c796e4db3130bfbcee6c36b68639d84ea04a9 100644
--- a/Online/GauchoAppl/src/components/PubSvc.cpp
+++ b/Online/GauchoAppl/src/components/PubSvc.cpp
@@ -14,6 +14,7 @@
 #include "GaudiKernel/IHistogramSvc.h"
 #include "GauchoAppl/CounterAdder.h"
 #include "GauchoAppl/SaveTimer.h"
+#include "GauchoAppl/HistAdder.h"
 #include "GauchoAppl/AdderSys.h"
 #include "Gaucho/IGauchoMonitorSvc.h"
 #include "Gaucho/MonCounter.h"
@@ -25,29 +26,24 @@ DECLARE_COMPONENT( PubSvc )
 
 using namespace Online;
 
-class PubSvc::MyErrh : public DimErrorHandler
-{
+class PubSvc::MyErrh : public DimErrorHandler   {
 public:
   bool m_flag;
   std::string name;
-  void errorHandler(int severity, int code, char *msg) override
-  {
+  void errorHandler(int severity, int code, char *msg) override  {
     if (m_flag)
       {
         ::lib_rtl_output(LIB_RTL_INFO,"DIM(%s): Code %d.%x %s\n",name.c_str(),severity,code,msg);
       }
     return;
   }
-  MyErrh (const std::string& n) : DimErrorHandler(), name(n)
-  {
+  MyErrh (const std::string& n) : DimErrorHandler(), name(n)  {
     m_flag = true;
   }
-  void start()
-  {
+  void start()  {
     m_flag = true;
   }
-  void stop()
-  {
+  void stop()  {
     m_flag = false;
   }
 };
@@ -66,10 +62,6 @@ PubSvc::PubSvc(const std::string& name, ISvcLocator* sl)
   declareProperty("AdderClass",      m_AdderClass     = "counter"); //Possible values are 'hists' for histigrams or 'counter' for counters.
 }
 
-PubSvc::~PubSvc()
-{
-}
-
 StatusCode PubSvc::queryInterface(const InterfaceID& riid, void** ppvIF)  {
   if ( IIncidentListener::interfaceID().versionMatch(riid) )
     *ppvIF = (IIncidentListener*)this;
@@ -79,53 +71,23 @@ StatusCode PubSvc::queryInterface(const InterfaceID& riid, void** ppvIF)  {
   return StatusCode::SUCCESS;
 }
 
-StatusCode PubSvc::initialize()
-{
+StatusCode PubSvc::initialize()   {
   StatusCode sc = this->Service::initialize();
   MsgStream msg( this->msgSvc(), this->name() );
-  if( !sc.isSuccess() )
-  {
+  if( !sc.isSuccess() )  {
     return sc;
   }
-  if ( this->m_TaskPattern.empty() )
-  {
+  if ( this->m_TaskPattern.empty() )  {
     msg << MSG::FATAL << "The option \"TaskPattern\" MUST be set!" << endmsg;
     return StatusCode::FAILURE;
   }
-  if ( this->m_ServicePattern.empty() )
-  {
+  if ( this->m_ServicePattern.empty() )  {
     msg << MSG::FATAL << "The option \"ServicePattern\" MUST be set!" << endmsg;
     return StatusCode::FAILURE;
   }
-#if 0
-//  if(m_dohisto)
-//  {
-//    sc = serviceLocator()->service("MonitorSvc", m_pMonitorSvc, true);
-//    if( sc.isSuccess() )
-//    {
-//      msg << MSG::DEBUG << "Found the IMonitorSvc interface" << endmsg;
-//    }
-//    else
-//    {
-//      msg << MSG::FATAL << "Unable to locate the IGauchoMonitorSvc interface." << endmsg;
-//      return StatusCode::FAILURE;
-//    }
-//    sc = serviceLocator()->service("HistogramDataSvc",m_phistsvc,true);
-//    if( sc.isSuccess() )
-//    {
-//      msg << MSG::DEBUG << "Found the Histogram Data Service interface" << endmsg;
-//    }
-//    else
-//    {
-//      msg << MSG::FATAL << "Unable to locate the Histogram Data Service interface." << endmsg;
-//      return StatusCode::FAILURE;
-//    }
-//  }
-#endif
   this->m_adder = 0;
   this->m_EoRadder = 0;
   this->m_SaveTimer = 0;
-  this->m_AdderSys = &AdderSys::Instance();
   sc = this->serviceLocator()->service("IncidentSvc",this->m_incidentSvc,true);
   if( !sc.isSuccess() ) {
     return sc;
@@ -155,36 +117,37 @@ StatusCode PubSvc::start()
   m_AdderClass     = RTL::str_lower(m_AdderClass);
   m_InputDNS       = RTL::str_lower(m_InputDNS);
   m_OutputDNS      = RTL::str_lower(m_OutputDNS);
-// Nodeadders:
-// Source task names:
-//  Reconstruction task structure: <Partition>_<Node>_RecBrunel_xx
-//  HLT Task structure: <node>_GAUCHOJOB_xx
-//  Nodeadder output name:
-//   Reconstruction: <part>_<node>_RecAdder_xx
-//   HLT: <node>_Adder_xx
-//
-// subfarm adders:
-// Source task names (all Farms):
-//  <node>_Adder_xx
-//  subfarm adder output name:
-//   Reconstruction: <part>_<node>_RecAdder_xx
-//   HLT: <sfnname>_Adder_xx     sfname = hltxyy
-//
-  StringReplace(m_TaskPattern,"<node>",nodename);
-  StringReplace(m_TaskPattern,"<part>", m_PartitionName);
+  //
+  // Nodeadders:
+  //
+  // Source task names:
+  //  Reconstruction task structure: <Partition>_<Node>_RecBrunel_xx
+  //  HLT Task structure: <node>_GAUCHOJOB_xx
+  //  Nodeadder output name:
+  //   Reconstruction: <part>_<node>_RecAdder_xx
+  //   HLT: <node>_Adder_xx
+  //
+  // subfarm adders:
+  // Source task names (all Farms):
+  //  <node>_Adder_xx
+  //  subfarm adder output name:
+  //   Reconstruction: <part>_<node>_RecAdder_xx
+  //   HLT: <sfnname>_Adder_xx     sfname = hltxyy
+  //
+  m_TaskPattern = RTL::str_replace(m_TaskPattern, "<node>", nodename);
+  m_TaskPattern = RTL::str_replace(m_TaskPattern, "<part>", m_PartitionName);
   m_TaskPattern += "(.*)";
-  StringReplace(m_ServicePattern,"<node>",nodename);
-  StringReplace(m_ServicePattern,"<part>", m_PartitionName);
+  m_ServicePattern = RTL::str_replace(m_ServicePattern, "<node>", nodename);
+  m_ServicePattern = RTL::str_replace(m_ServicePattern, "<part>", m_PartitionName);
   m_myservicename = m_MyName;
-  StringReplace(m_myservicename, "<part>", m_PartitionName);
-  StringReplace(m_myservicename, "<node>", nodename);
-  const char *dnsnode = getenv("DIM_DNS_NODE");
-  std::string ddns = RTL::str_lower(dnsnode ? dnsnode : "");
-  StringReplace(m_InputDNS,"<node>",nodename);
-  StringReplace(m_InputDNS,"<dns>",ddns);
+  m_myservicename = RTL::str_replace(m_myservicename, "<part>", m_PartitionName);
+  m_myservicename = RTL::str_replace(m_myservicename, "<node>", nodename);
+  std::string ddns = RTL::str_lower(getenv("DIM_DNS_NODE") ? getenv("DIM_DNS_NODE") : "");
+  m_InputDNS = RTL::str_replace(m_InputDNS, "<node>", nodename);
+  m_InputDNS = RTL::str_replace(m_InputDNS, "<dns>",  ddns);
   if ( !m_OutputDNS.empty() )  {
-    StringReplace(m_OutputDNS,"<node>",nodename);
-    StringReplace(m_OutputDNS,"<dns>",ddns);
+    m_OutputDNS = RTL::str_replace(m_OutputDNS, "<node>", nodename);
+    m_OutputDNS = RTL::str_replace(m_OutputDNS, "<dns>", ddns);
   }
   else  {
     m_OutputDNS = ddns;
@@ -199,16 +162,14 @@ StatusCode PubSvc::start()
   if ( !m_InputDNS.empty() )   {
     DimClient::setDnsNode(m_InputDNS.c_str());
   }
-  if ( m_AdderClass == "counter" )  {
-    m_adder = new CounterAdder(m_myservicename.c_str(), "Data");
-  }
-  else  {
-    m_adder = new HistAdder(m_myservicename.c_str(), "Data");
-  }
-  if (m_OutputDNS != ddns)  {
-    m_adder->setServiceDns(m_AdderSys->getDNS(m_OutputDNS,m_myservicename));
-  }
-  m_adder->setIsSaver(false);
+  if ( m_AdderClass == "counter" )
+    m_adder = new CounterAdder(m_myservicename, m_myservicename, "Data", ADD_COUNTER);
+  else
+    m_adder = new HistAdder(m_myservicename, m_myservicename, "Data", ADD_HISTO);
+
+  auto dns = AdderSys::instance().getDNS(m_OutputDNS,m_myservicename);
+  m_adder->serviceDNS = dns;
+  m_adder->isSaver        = false;
   m_adder->isEOR          = m_isEOR;
   m_adder->expandRate     = false;
   m_adder->taskPattern    = m_TaskPattern;
@@ -217,18 +178,14 @@ StatusCode PubSvc::start()
   m_adder->rectmo         = 0;
   m_adder->disableOutput  = true;
   m_adder->noRPC          = true;
-  m_adder->monSvc         = dynamic_cast<IGauchoMonitorSvc*>(m_pMonitorSvc);
   m_adder->debugOn        = m_debugOn;
-  m_adder->Configure();
-  m_AdderSys->add(m_adder);
-  if ( m_adder->serviceDns() )
-    m_adder->serviceDns()->autoStartOn();
+  m_adder->configure();
+  dns->autoStartOn();
   m_started = true;
   return StatusCode::SUCCESS;
 }
 
-StatusCode PubSvc::stop()
-{
+StatusCode PubSvc::stop()    {
   IGauchoMonitorSvc* psvc = dynamic_cast<IGauchoMonitorSvc*>(m_pMonitorSvc);
   if (psvc) psvc->resetHistos(this);
 
@@ -236,36 +193,28 @@ StatusCode PubSvc::stop()
   return Service::stop();
 }
 
-StatusCode PubSvc::finalize()
-{
+StatusCode PubSvc::finalize()   {
   if ( m_trender )    {
     this->tools()->releaseTool(m_trender).ignore();
     this->m_trender = 0;
   }
   m_arrhist = 0;
-  if ( m_pMonitorSvc )
-  {
+  if ( m_pMonitorSvc )  {
     m_pMonitorSvc->undeclareAll(this);
   }
-  if ( m_incidentSvc )
-  {
+  if ( m_incidentSvc )  {
     m_incidentSvc->removeListener(this);
   }
   releasePtr(m_incidentSvc);
   releasePtr(m_pMonitorSvc);
-  if (m_SaveTimer != 0)
-  {
+  if (m_SaveTimer != 0)  {
     m_SaveTimer->stop();
     deletePtr(m_SaveTimer);
   }
-  if (m_adder != 0)
-  {
-    m_AdderSys->remove(m_adder);
+  if (m_adder != 0)  {
     deletePtr(m_adder);
   }
-  if (m_EoRadder != 0)
-  {
-    m_AdderSys->remove(m_EoRadder);
+  if (m_EoRadder != 0)  {
     deletePtr(m_EoRadder);
   }
   return Service::finalize();
@@ -280,13 +229,12 @@ SmartIF<IToolSvc> PubSvc::tools()    {
   return svc;
 }
 
-void PubSvc::handle(const Incident& inc)
-{
+void PubSvc::handle(const Incident& inc)   {
   if (inc.type() == "APP_RUNNING")  {
-    m_AdderSys->start();
+    AdderSys::instance().start();
   }
   else if (inc.type() == "APP_STOPPED")  {
-    m_AdderSys->stop();
+    AdderSys::instance().stop();
   }
 }
 
@@ -300,9 +248,9 @@ void PubSvc::startTrending(const std::string& partition, const std::string& nam,
 }
 
 namespace   {
-  void _Analyze(void *arg, void* buff, int siz, MonMap *mmap, MonAdder *)  {
+  void _Analyze(void *arg, mem_buff& buff, MonitorItems *mmap, MonAdder *)  {
     PubSvc *tis = (PubSvc*) arg;
-    tis->analyze(buff, siz, mmap);
+    tis->analyze(buff, mmap);
   }
 }
 
@@ -312,5 +260,5 @@ void PubSvc::startCycling()    {
   }
 }
 
-void PubSvc::analyze(void* , int , Online::MonMap* )   {
+void PubSvc::analyze(mem_buff& , Online::MonitorItems* )   {
 }
diff --git a/Online/GauchoAppl/src/components/PubSvc.h b/Online/GauchoAppl/src/components/PubSvc.h
index 8eb900ca0c28a5bd63c4a3e30f8cfa39b2711361..bf806b65f3e6bfe11503d368391a5789d584aa72 100644
--- a/Online/GauchoAppl/src/components/PubSvc.h
+++ b/Online/GauchoAppl/src/components/PubSvc.h
@@ -24,8 +24,8 @@ class IGauchoMonitorSvc;
 class IHistogramSvc;
 class ISimpleTrendWriter;
 
+class DimServiceDns;
 namespace Online   {
-  class AdderSys;
   class SaveTimer;
 }
 
@@ -33,7 +33,7 @@ class PubSvc : public Service, virtual public IIncidentListener    {
 public:
   class MyErrh;
   PubSvc(const std::string& name, ISvcLocator* sl);
-  virtual ~PubSvc();
+  virtual ~PubSvc() = default;
   //IInterface pure member functions
   virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF) override;
   virtual StatusCode initialize() override;
@@ -42,19 +42,21 @@ public:
   virtual StatusCode finalize() override;
   virtual void handle(const Incident&) override;
 
-  virtual void analyze(void *buff, int siz, Online::MonMap* mmap);
+  virtual void analyze(mem_buff& buff, Online::MonitorItems* mmap);
   void startCycling();
   void startTrending(const std::string& partition, const std::string& name, int tmo);
 
   SmartIF<IToolSvc> tools();
 
+  DimServerDns* dns() const {  return this->m_adder->serviceDNS.get();   }
+
+
   /// Reference to the IncidentSvc instance
   IIncidentSvc       *m_incidentSvc  {nullptr};
   ISimpleTrendWriter* m_trender  {nullptr};
   IMonitorSvc        *m_pMonitorSvc  {nullptr};
 
   AIDA::IHistogram1D *m_arrhist      {nullptr};
-  Online::AdderSys   *m_AdderSys     {nullptr};
   Online::MonAdder   *m_adder        {nullptr};
   Online::MonAdder   *m_EoRadder     {nullptr};
   Online::SaveTimer  *m_SaveTimer    {nullptr};
diff --git a/Online/GauchoAppl/src/components/RateSvc.cpp b/Online/GauchoAppl/src/components/RateSvc.cpp
index aef73d620a56df703347f13a35aa11e521cb4a26..4052dd98818802dc55dd71006c7c5a18393de529 100644
--- a/Online/GauchoAppl/src/components/RateSvc.cpp
+++ b/Online/GauchoAppl/src/components/RateSvc.cpp
@@ -16,17 +16,17 @@
 DECLARE_COMPONENT( RateSvc )
 using namespace Online;
 
-void RateSvc::analyze(void *, int ,MonMap* mmap)    {
+void RateSvc::analyze(mem_buff& ,MonitorItems* mmap)    {
   makerate(mmap);
 }
 
 
 
-void RateSvc::makerate(MonMap* mmap)
+void RateSvc::makerate(MonitorItems* mmap)
 {
 #define MAX_SERVICE_SIZE 128
   std::string nnam;
-  MonMap::iterator it;
+  MonitorItems::iterator it;
   double rate;
   if (m_enableTrending && m_trender)
   {
@@ -103,10 +103,10 @@ void RateSvc::makerate(MonMap* mmap)
   }
 }
 
-void RateSvc::makecounters(MonMap* mmap)
+void RateSvc::makecounters(MonitorItems* mmap)
 {
 #define MAX_SERVICE_SIZE 128
-  MonMap::iterator it;
+  MonitorItems::iterator it;
   DimBuffBase *b;
   for (it=mmap->begin();it!= mmap->end();it++)
   {
diff --git a/Online/GauchoAppl/src/components/RateSvc.h b/Online/GauchoAppl/src/components/RateSvc.h
index 40801af773ffe4fe8a8ddfbe24f2e4a3dfca7006..413bf849c4cedbb5dffb0ca6c544525c00e63dee 100644
--- a/Online/GauchoAppl/src/components/RateSvc.h
+++ b/Online/GauchoAppl/src/components/RateSvc.h
@@ -60,10 +60,10 @@ public:
   virtual ~RateSvc() = default;
   StatusCode start() override;
   StatusCode stop() override;
-  void analyze(void *buff, int siz, Online::MonMap* mmap)  override;
+  void analyze(mem_buff& buffer, Online::MonitorItems* mmap)  override;
 
-  void makerate(Online::MonMap* mmap);
-  void makecounters(Online::MonMap* mmap);
+  void makerate(Online::MonitorItems* mmap);
+  void makecounters(Online::MonitorItems* mmap);
 
   void *m_oldProf;
   OUTServiceMap m_outputServicemap;
diff --git a/Online/GauchoAppl/src/components/StorageSvc.cpp b/Online/GauchoAppl/src/components/StorageSvc.cpp
index a8dbed2c45ae76786aa4b18cccb43f66811e8fec..386a6aa11eec3e2cc8de2de4dd5dd7ea860abb59 100644
--- a/Online/GauchoAppl/src/components/StorageSvc.cpp
+++ b/Online/GauchoAppl/src/components/StorageSvc.cpp
@@ -34,9 +34,8 @@ StatusCode StorageSvc::initialize()
   return sc;
 }
 
-void StorageSvc::analyze(void *, int, MonMap* mmap)
-{
-  MonMap::iterator i, j, k, l;
+void StorageSvc::analyze(mem_buff&, MonitorItems* mmap)  {
+  MonitorItems::iterator i, j, k, l;
   j = mmap->find("R_Runable/EvtCount");
   if (j == mmap->end())
     return;
diff --git a/Online/GauchoAppl/src/components/StorageSvc.h b/Online/GauchoAppl/src/components/StorageSvc.h
index 065e4dbb821b646d693fe0c344e248aed441b1bc..cbb34dc55c5897c08ac005d907c43567be10d834 100644
--- a/Online/GauchoAppl/src/components/StorageSvc.h
+++ b/Online/GauchoAppl/src/components/StorageSvc.h
@@ -27,7 +27,7 @@ class StorageSvc: public PubSvc   {
     virtual ~StorageSvc() = default;
     StatusCode start() override;
     StatusCode initialize() override;
-    void analyze(void *buff, int siz, Online::MonMap* mmap)  override;
+    void analyze(mem_buff& buffer, Online::MonitorItems* mmap)  override;
     bool m_enableTrending;
 };
 
diff --git a/Online/GauchoAppl/src/components/StrandedServices.h b/Online/GauchoAppl/src/components/StrandedServices.h
index 06101261a9e8a48f4c817121e881c2f990766e57..88382c93fc563d545c49b6ea1188318ffd1ba2e7 100644
--- a/Online/GauchoAppl/src/components/StrandedServices.h
+++ b/Online/GauchoAppl/src/components/StrandedServices.h
@@ -25,43 +25,29 @@
 #include "GaudiKernel/IIncidentListener.h"
 #include "dim/dic.hxx"
 
-
 #include "CPP/Event.h"
 #include "CPP/Interactor.h"
 
 class StrandedServices;
 
-class StrandBrowser : public Interactor
-{
+class StrandBrowser : public Interactor   {
   public:
   StrandBrowser(StrandedServices *s);
   StrandedServices *gService;
-    /// Interactor overload: handle Sensor stimuli
-    void handle(const Event& ev) override;
+  /// Interactor overload: handle Sensor stimuli
+  void handle(const Event& ev) override;
 };
 
-
-
-
-
-
-
-class StrandInfo : public DimInfo
-{
+class StrandInfo : public DimInfo   {
 public:
   StrandInfo(std::string name, StrandBrowser *s);
-  virtual ~StrandInfo()
-  {
-
-  }
+  virtual ~StrandInfo() = default;
   void infoHandler() override;
   std::string m_name;
   StrandBrowser *m_service;
-
 };
 
-class StrandedServices : public Service,virtual public IIncidentListener
-{
+class StrandedServices : public Service,virtual public IIncidentListener    {
 public:
   StrandedServices(const std::string& name, ISvcLocator* sl);
   ~StrandedServices();
diff --git a/Online/GauchoAppl/test/Addertst.cpp b/Online/GauchoAppl/test/Addertst.cpp
index 7bf5e402d3776e7e7423bc0b4a84758e9a47eeb1..31df5314c5865c115a1f3d8ada978c1ede046606 100644
--- a/Online/GauchoAppl/test/Addertst.cpp
+++ b/Online/GauchoAppl/test/Addertst.cpp
@@ -23,110 +23,86 @@ static int nCB=0;
 
 using namespace Online;
 
-void CycleFn(void * ,void *,int , MonMap *hm, MonAdder *)
+void CycleFn(void*, mem_buff&, MonitorItems *hm, MonAdder *)
 {
   printf("=====================================Cycle CallBack Function\n");
-  int j=0;
-  if ((nCB % 10) != 0)
-  {
+  if ((nCB % 10) != 0)  {
     nCB++;
     return;
   }
   nCB++;
-  for (MonIter i=hm->begin();i!=hm->end();i++)
-   {
-      j++;
-//      printf("%s ",i->first.c_str());
-      DimBuffBase *p=(DimBuffBase*)i->second;
-      char *nam =(char*)AddPtr(p,p->nameoff);
-      char *stype=0;
-      switch (p->type)
-      {
-        case H_1DIM:
-        {
-          stype = (char*)"H_1DIM";
-          break;
-        }
-        case H_PROFILE:
-        {
-          stype = (char*)"H_PROFILE";
-          break;
-        }
-        case H_RATE:
-        {
-          stype = (char*)"H_RATE";
-          break;
-        }
-        case H_2DIM:
-        {
-          stype = (char*)"H_2DIM";
-          break;
-        }
-        case H_3DIM:
-        {
-          stype = (char*)"H_3DIM";
-          break;
-        }
-        case C_STATENT:
-        {
-          stype = (char*)"C_STATENT";
-          break;
-        }
+  int j = 0;
+  for ( auto i=hm->begin(); i != hm->end(); ++i )   {
+    DimBuffBase *p=(DimBuffBase*)i->second;
+    char *nam =(char*)AddPtr(p,p->nameoff);
+    const char *stype=0;
+    ++j;
+    switch (p->type)      {
+    case H_1DIM:
+      stype = "H_1DIM";
+      break;
+    case H_PROFILE:
+      stype = "H_PROFILE";
+      break;
+    case H_RATE:
+      stype = "H_RATE";
+      break;
+    case H_2DIM:
+      stype = "H_2DIM";
+      break;
+    case H_3DIM:
+      stype = "H_3DIM";
+      break;
+    case C_STATENT:
+      stype = "C_STATENT";
+      break;
+    }
+    TObject *ro;
+    ro = (TObject*)HistSerDes::de_serialize(i->second);
+    bool draw=((j==5) || (j==7) || (j==13));
+    switch (p->type)     {
+    case H_1DIM:
+    case H_PROFILE:
+    case H_RATE:        {
+      DimHistbuff1 *p=(DimHistbuff1*)i->second;
+      printf("\t\t%s %s. Dimension %d #bins %d Nentries %lli\n",stype,nam, p->dim,p->x.nbin,(long long)p->nentries);
+      if ((MONTYPE)p->type == H_1DIM)     {
+	TH1D *r=(TH1D *)ro;
+	if (draw) r->Draw();
       }
-      TObject *ro;
-      ro = (TObject*)HistSerDes::de_serialize(i->second);
-      bool draw=((j==5) || (j==7) || (j==13));
-      switch (p->type)
-      {
-        case H_1DIM:
-        case H_PROFILE:
-        case H_RATE:
-        {
-          DimHistbuff1 *p=(DimHistbuff1*)i->second;
-          printf("\t\t%s %s. Dimension %d #bins %d Nentries %lli\n",stype,nam, p->dim,p->x.nbin,(long long)p->nentries);
-          if ((MONTYPE)p->type == H_1DIM)
-          {
-            TH1D *r=(TH1D *)ro;
-            if (draw) r->Draw();
-          }
-          else
-          {
-            TProfile *r=(TProfile *)ro;
-            if (draw) r->Draw();
-
-          }
-          break;
-        }
-        case H_2DIM:
-        {
-          DimHistbuff2 *p=(DimHistbuff2*)i->second;
-          printf("\t\t%s %s. Dimension %d #x-bins %d #y-bins %d Nentries %lli\n",stype,nam,p->dim,p->x.nbin,p->y.nbin,(long long)p->nentries);
-          TH2D *r=(TH2D *)ro;
-          if (draw) r->Draw();
-          break;
-        }
-        case H_3DIM:
-        {
-          DimHistbuff3 *p=(DimHistbuff3*)i->second;
-          printf("\t\t%s %s. Dimension %d #x-bins %d #y-bins %d Nentries %lli\n",stype,nam,p->dim,p->x.nbin,p->y.nbin,(long long)p->nentries);
-          TH3D *r=(TH3D *)ro;
-          if (draw) r->Draw();
-          break;
-        }
-        case C_STATENT:
-        {
-          DimStatBuff *p=(DimStatBuff*)i->second;
-          printf("\t\t%s %s. Nentries %lli\n",stype,nam, (long long)p->nentries);
-          break;
-        }
+      else     {
+	TProfile *r=(TProfile *)ro;
+	if (draw) r->Draw();
       }
-   }
+      break;
+    }
+    case H_2DIM:      {
+      DimHistbuff2 *p=(DimHistbuff2*)i->second;
+      printf("\t\t%s %s. Dimension %d #x-bins %d #y-bins %d Nentries %lli\n",stype,nam,p->dim,p->x.nbin,p->y.nbin,(long long)p->nentries);
+      TH2D *r=(TH2D *)ro;
+      if (draw) r->Draw();
+      break;
+    }
+    case H_3DIM:     {
+      DimHistbuff3 *p=(DimHistbuff3*)i->second;
+      printf("\t\t%s %s. Dimension %d #x-bins %d #y-bins %d Nentries %lli\n",stype,nam,p->dim,p->x.nbin,p->y.nbin,(long long)p->nentries);
+      TH3D *r=(TH3D *)ro;
+      if (draw) r->Draw();
+      break;
+    }
+    case C_STATENT:     {
+      DimStatBuff *p=(DimStatBuff*)i->second;
+      printf("\t\t%s %s. Nentries %lli\n",stype,nam, (long long)p->nentries);
+      break;
+    }
+    }
+  }
   canv->Update();
 }
+
 #include "TROOT.h"
 #include "TApplication.h"
-int main (int argc, char *argv[])
-{
+int main (int argc, char *argv[])   {
   TH1D::SetDefaultSumw2();
   TH2D::SetDefaultSumw2();
   TApplication *app=new TApplication("Shit",&argc,argv);
@@ -134,12 +110,7 @@ int main (int argc, char *argv[])
   gROOT->Draw();
   canv->Show();
   canv->Draw();
-//  char *nam = (char*)"AAABBB";
-//  if (argc > 1)
-//  {
-//    nam = argv[1];
-//  }
-  HistAdder *a=new HistAdder((char*)"Adder",(char*)"Histos/Data");
+  HistAdder *a = new HistAdder("Test","Adder","Histos/Data", ADD_HISTO);
   a->SetCycleFn(&CycleFn,0);
   app->Run();
   sleep(1000000000);
diff --git a/Online/GauchoAppl/test/RateTest.cpp b/Online/GauchoAppl/test/RateTest.cpp
deleted file mode 100644
index 9fa315af41042d3ae17a0755ff05cfd99ffa6b9b..0000000000000000000000000000000000000000
--- a/Online/GauchoAppl/test/RateTest.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-//==========================================================================
-//  LHCb Online software suite
-//--------------------------------------------------------------------------
-// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
-// All rights reserved.
-//
-// For the licensing terms see OnlineSys/LICENSE.
-//
-// Author     : B.Jost
-//
-//==========================================================================
-#include "Gaucho/MonRate.h"
-#include "Gaucho/RateMgr.h"
-
-using namespace Online;
-
-int main(int ,char**)
-{
-  unsigned long long dt;
-  int i = 0;
-  long long j = 0;
-  double d;
-  long long al[100];
-  int ai[100];
-  //  StatEntity se;
-  RateMgr rm("");
-  for (int ii=0;ii<100;ii++)
-    {
-      al[ii] = ii+1;
-      ai[ii] = ii+2;
-    }
-  MonRateBase *r1 = new MonRate<int>("int","hkjashda",i);
-  MonRateBase *r2 = new MonRate<long>("long long","hkjashda",j);
-  MonRateBase *r3 = new MonRate<double>("double","hkjashda",d);
-  //  MonRateBase *r4 = new MonRate<StatEntity>("StatEntity","hkjashda",se);
-  MonRateBase *r5 = new MonRate<long long*>("long*","jashdjah","X",al,sizeof(al));
-  MonRateBase *r6 = new MonRate<int*>("int*","jashdjah","i",ai,sizeof(ai));
-  rm.addRate("int",*r1);
-  rm.addRate("long long",*r2);
-  rm.addRate("double",*r3);
-  //  rm.addRate("StatEntity",*r4);
-  rm.addRate("long*",*r5);
-  rm.addRate("int*",*r6);
-  dt = 100000000;
-  i = 30;
-  j = 45;
-  d = 450000000.0;
-  //  se++;
-  rm.makeRates(dt);
-  rm.print();
-  MonRateBase *br1 = r1;
-  MonRateBase *br6 = r6;
-  delete br1;
-  delete br6;
-  return 0;
-}
diff --git a/Online/GauchoBase/Gaucho/BRTL_Lock.h b/Online/GauchoBase/Gaucho/BRTL_Lock.h
index bde3d554690dddc764c9d3d5e0020461e1de7b62..621b2d682e2c31f77a0ad706486b8d6ab3679e7c 100644
--- a/Online/GauchoBase/Gaucho/BRTL_Lock.h
+++ b/Online/GauchoBase/Gaucho/BRTL_Lock.h
@@ -23,9 +23,9 @@
 #include <string>
 #include <chrono>
 using namespace std::chrono;
-class BRTLLock
-{
-public:
+
+class BRTLLock   {
+ public:
   pthread_mutex_t m_lid;
   std::string m_name;
   high_resolution_clock::time_point m_tryLockTime;
@@ -35,5 +35,12 @@ public:
   ~BRTLLock(void);
   int lockMutex();
   int unlockMutex();
+
+ public:
+  struct _Lock   {
+    BRTLLock* mtx;
+    _Lock(BRTLLock* m) : mtx(m) { if ( mtx ) mtx->lockMutex();   }
+    ~_Lock()                    { if ( mtx ) mtx->unlockMutex(); }
+  };
 };
 #endif /* BRTL_LOCK_H_ */
diff --git a/Online/GauchoBase/Gaucho/CntrMgr.h b/Online/GauchoBase/Gaucho/CntrMgr.h
index da9a162e51d2a134a7fc537ba56699db9545da27..86c2cc9fc5dadb40b6842d102ea5daa3a98ce34b 100644
--- a/Online/GauchoBase/Gaucho/CntrMgr.h
+++ b/Online/GauchoBase/Gaucho/CntrMgr.h
@@ -20,8 +20,7 @@ class StatEntity;
 /// Online namespace declaration
 namespace Online   {
 
-  class CntrMgr
-  {
+  class CntrMgr    {
   public:
     typedef std::map<std::string, std::pair<std::string,std::pair<std::string, const void*> > > CounterMap;
     typedef CounterMap::iterator counterMapIt;
@@ -47,38 +46,30 @@ namespace Online   {
 
     void i_addCounter(const std::string& nam, const std::string& descr, const std::string& type, const void* count);
 
-    void addCounter(const std::string& countName, const std::string& countDescription, const double& count)
-    {
+    void addCounter(const std::string& countName, const std::string& countDescription, const double& count)    {
       i_addCounter(countName,countDescription,"double",&count);
     }
-    void addCounter(const std::string& countName, const std::string& countDescription, const int& count)
-    {
+    void addCounter(const std::string& countName, const std::string& countDescription, const int& count)    {
       i_addCounter(countName,countDescription,"int",&count);
     }
-    void addCounter(const std::string& countName, const std::string& countDescription, const long& count)
-    {
+    void addCounter(const std::string& countName, const std::string& countDescription, const long& count)    {
       i_addCounter(countName,countDescription,"long",&count);
     }
-    void addCounter(const std::string& countName, const std::string& countDescription, const StatEntity& count)
-    {
+    void addCounter(const std::string& countName, const std::string& countDescription, const StatEntity& count)    {
       i_addCounter(countName+"-flag",countDescription+"-flag","StatEntityflag",&count);
       i_addCounter(countName+"-nEntries",countDescription+"-nEntries","StatEntitynEntries",&count);
     }
-    void removeCounter (const std::string &name)
-    {
+    void removeCounter (const std::string &name)    {
       counterMapIt it = m_counterMap.find(name);
-      if (it != m_counterMap.end())
-	{
-	  m_counterMap.erase(it);
-	}
+      if (it != m_counterMap.end())	{
+	m_counterMap.erase(it);
+      }
     }
-    void removeCounterAll()
-    {
+    void removeCounterAll()    {
       m_counterMap.clear();
     }
 
-    void addComplement(int* runNumber, unsigned int* triggerConfigurationKey, int* cycleNumber, double* deltaT, double* offsetTimeFirstEvInRun, double* offsetTimeLastEvInCycle, double* offsetGpsTimeLastEvInCycle)
-    {
+    void addComplement(int* runNumber, unsigned int* triggerConfigurationKey, int* cycleNumber, double* deltaT, double* offsetTimeFirstEvInRun, double* offsetTimeLastEvInCycle, double* offsetGpsTimeLastEvInCycle)    {
       m_runNumber = runNumber;
       m_triggerConfigurationKey = triggerConfigurationKey;
       m_cycleNumber = cycleNumber;
@@ -100,4 +91,3 @@ namespace Online   {
   };
 }
 #endif //GAUCHO_CNTRMGR_H
-
diff --git a/Online/GauchoBase/Gaucho/CounterSubSys.h b/Online/GauchoBase/Gaucho/CounterSubSys.h
index 74327874bba270deff6c714be05ec2db248961ff..7a7d017bd2b3439d99adea6d491bd8d50483cbea 100644
--- a/Online/GauchoBase/Gaucho/CounterSubSys.h
+++ b/Online/GauchoBase/Gaucho/CounterSubSys.h
@@ -11,70 +11,55 @@
 //==========================================================================
 #pragma once
 
-#include "Gaucho/MonSubSys.h"
-#include "Gaucho/MonCounter.h"
-#include "Gaucho/MonRate.h"
+#include <Gaucho/MonSubSys.h>
+#include <Gaucho/MonCounter.h>
+#include <Gaucho/MonRate.h>
+
 #include <set>
+
 /// Online namespace declaration
 namespace Online  {
 
   class CounterSubSys : public MonSubSys  {
   public:
     std::string            ratePrefix;
-    std::set<std::string>  entrySet;
     std::string            expandInfix;
     int                    updatePeriod;
     bool                   expandnames  { false };
 
+  public:
+
+    CounterSubSys(SubSysParams &params);
+    virtual ~CounterSubSys() = default;
+
     template<typename T> void add_counter(const std::string& name, const std::string &anme, const T&  var);
     template<typename T> void add_counter(const std::string& name, const std::string &anme, const std::string &fmt, T var, int siz);
     template<typename T> void add_counter(const std::string& name, const std::string &anme, const T &var1, const T&var2);
-    void add_counter(MonBase *h, MonRateBase *r);
-
-    CounterSubSys(SubSysParams &params);
-    virtual ~CounterSubSys();
+    void add_counter(std::unique_ptr<MonBase>&& h, std::unique_ptr<MonRateBase>&& r);
     void setup(const std::string& n, bool expand=false) override;
-    void remove(const std::string& name) override;
+    virtual size_t remove(const std::string& name)  override;
   };
 
   /// generic addEntry
   template<typename T> void CounterSubSys::add_counter(const std::string& nam, const std::string &desc, const T&  var) {
-    MonBase *cnt = new MonCounter<T>(nam,desc,var);
-    this->objMap.emplace(cnt->name,cnt);
-    this->entrySet.insert(nam);
-    this->numObjs++;
-    std::string rName = this->ratePrefix+nam;
-    MonRate<T> *cntr = new MonRate<T>(rName,desc,var);
-    this->objMap.emplace(cntr->name,cntr);
-    this->add_counter(cnt, cntr);
-    this->classMgr.registerEntry(cnt);
-    this->classMgr.registerEntry(cntr);
+    std::unique_ptr<MonBase>     cnt = std::make_unique<MonCounter<T> >(nam,desc,var);
+    std::unique_ptr<MonRateBase> mr  = std::make_unique<MonRate<T> >   (this->ratePrefix+nam, desc, var);
+    this->add_counter(std::move(cnt), std::move(mr));
   }
 
   /// addEntry for arrays
   template<typename T> void CounterSubSys::add_counter(const std::string& nam, const std::string &desc,
-						    const std::string &fmt, T const var, int siz) {
-    MonBase *cnt = new MonCounter<T>(nam,desc,fmt,var,siz);
-    this->entrySet.insert(nam);
-    this->objMap.emplace(cnt->name,cnt);
-    this->numObjs++;
-
-    std::string rName = this->ratePrefix+nam;
-    MonRateBase *mr = new MonRate<T>(rName,desc,fmt,var,siz);
-    this->objMap.emplace(mr->name,mr);
-    this->add_counter(cnt,mr);
-    this->classMgr.registerEntry(cnt);
-    this->classMgr.registerEntry(mr);
+						       const std::string &fmt, T const var, int siz) {
+    std::unique_ptr<MonBase>     cnt = std::make_unique<MonCounter<T> >(nam,desc,fmt,var,siz);
+    std::unique_ptr<MonRateBase> mr  = std::make_unique<MonRate<T> >   (this->ratePrefix+nam, desc, fmt, var, siz);
+    this->add_counter(std::move(cnt), std::move(mr));
   }
 
   /// addEntry for pairs
   template<typename T> void CounterSubSys::add_counter(const std::string& nam, const std::string &desc, const T&  var1, const T&  var2) {
-    std::pair<T*,T*> *p=new std::pair<T*,T*>((T*)&var1,(T*)&var2);
-    MonBase *cnt = new MonCounter<std::pair<T*,T*>>(nam, desc, *p);
-    this->objMap.emplace(cnt->name,cnt);
-    this->entrySet.insert(nam);
-    this->numObjs++;
-    this->add_counter(cnt,0);
-    this->classMgr.registerEntry(cnt);
+    std::pair<T*,T*> *p = new std::pair<T*,T*>((T*)&var1,(T*)&var2);
+    std::unique_ptr<MonBase>     cnt = std::make_unique<MonCounter<std::pair<T*,T*> > >(nam, desc, *p);
+    std::unique_ptr<MonRateBase> mr;
+    this->add_counter(std::move(cnt), std::move(mr));
   }
 }
diff --git a/Online/GauchoBase/Gaucho/GenTimer.h b/Online/GauchoBase/Gaucho/GenTimer.h
index 1cee3c796cca5ba18ef4d78e3ffec3fc7e57727d..e0bd20d662e476918cf36b86f612bb5591cee7ac 100644
--- a/Online/GauchoBase/Gaucho/GenTimer.h
+++ b/Online/GauchoBase/Gaucho/GenTimer.h
@@ -27,26 +27,25 @@ namespace Online  {
 
   class GenTimer   {
   public:
-    bool m_periodic;
-    bool m_synched;
-    bool m_ForceExit;
-    bool m_timeout;
-    void *m_arg;
-    unsigned long  m_period;
-    unsigned long m_dueTime;
-    unsigned long m_lastfire;
-    unsigned long m_lastdelta;
-    unsigned long *m_extlastdelta;
-    int m_ThreadBalance;
-    bool m_stopSeen;
-    pid_t m_threadpid;
-    std::thread *m_thread;
-    //  lib_rtl_thread_t m_thread;
-    int m_type;
+    bool periodic;
+    bool synched;
+    bool m_ForceExit   { true };
+    bool m_timeout     { false };
+    void *arg { nullptr };
+    unsigned long  period;
+    unsigned long  m_dueTime    { 0 };
+    unsigned long  m_lastfire { 0 };
+    unsigned long  m_lastdelta { 0 };
+    unsigned long *m_extlastdelta { nullptr };
+    int m_ThreadBalance  { 0 };
+    bool m_stopSeen   { false };
+    pid_t m_threadpid { 0 };
+    std::unique_ptr<std::thread> m_thread;
+    int  type;
     void makeDeltaT(void);
   public:
     BRTLLock m_lock;
-    bool m_dontdimlock;
+    bool m_dontdimlock { true };
     GenTimer(void *arg, int period = 10000,int typ=TIMER_TYPE_PERIODIC+TIMER_MODIFYER_SYNCHRONIZED);
     // Period is in milli-seconds...
     virtual ~GenTimer(void);
diff --git a/Online/GauchoBase/Gaucho/HistSubSys.h b/Online/GauchoBase/Gaucho/HistSubSys.h
index a0245473613d9656ff46fbb4eddfdf1f986a0921..98d202aae6e593256f3169311dde80a27ded9a3c 100644
--- a/Online/GauchoBase/Gaucho/HistSubSys.h
+++ b/Online/GauchoBase/Gaucho/HistSubSys.h
@@ -23,17 +23,17 @@ namespace Online  {
     int    updatePeriod;
     size_t xmitSize {0};
 
-    void i_addEntry(MonBase *m);
+    void i_addEntry(std::unique_ptr<MonBase>&& histo);
 
   public:
     template<typename T> void add_hist(const std::string& name, const std::string &desc, const T&  var)  {
-      i_addEntry(new MonHist<T>(name,desc,var));
+      i_addEntry(std::make_unique<MonHist<T> >(name,desc,var));
     }
     HistSubSys(SubSysParams& params);
-    virtual ~HistSubSys();
+    virtual ~HistSubSys() = default;
     void setup(const std::string& n, bool expand=false) override;
     void setExtLastDelta(unsigned long deltaT);
-    void remove(const std::string &name) override;
+    virtual size_t remove(const std::string& name)  override;
   };
 }
 #endif
diff --git a/Online/GauchoBase/Gaucho/MonBase.h b/Online/GauchoBase/Gaucho/MonBase.h
index a5751d9bbe5503e77f03d35a964fefcad783a7b6..545a9ea41f484316329ebfd08d5c333602e2e289 100644
--- a/Online/GauchoBase/Gaucho/MonBase.h
+++ b/Online/GauchoBase/Gaucho/MonBase.h
@@ -28,13 +28,15 @@ namespace Online  {
 
   template<typename...> inline constexpr bool false_v = false;
 
-  struct MonBase   {
+  class MonBase   {
+  public:
     MONTYPE      type       { H_ILLEGAL };
     std::string  name       {   };
     std::string  title    {   };
     unsigned int buffersize { 0 };  /* buffer size of the data if serialized*/
     unsigned int m_contsiz  { 0 };  /* Allocated length in Bytes for the bin contents */
 
+  public:
     MonBase() = delete;
     MonBase(MONTYPE typ, const std::string& nam, const std::string& tit,
 	    unsigned int bufsize=0, unsigned int contsiz=0);
@@ -62,7 +64,7 @@ namespace Online  {
       return s;
     }
     virtual int   xmitbuffersize() = 0;
-    virtual int   Serialize(void* &ptr) = 0;
+    virtual int   serialize(void* ptr) = 0;
     virtual void  create_OutputService(const std::string& connection) = 0;
     virtual void  delete_OutputService() {}
     virtual void  update_OutputService() {}
diff --git a/Online/GauchoBase/Gaucho/MonClassMgr.h b/Online/GauchoBase/Gaucho/MonClassMgr.h
index a24bb21e3eee49a7ff943170702b6618aba7f0a3..b272bdd71573abd58d5165f12b21afe5beb78b17 100644
--- a/Online/GauchoBase/Gaucho/MonClassMgr.h
+++ b/Online/GauchoBase/Gaucho/MonClassMgr.h
@@ -12,48 +12,61 @@
 #ifndef ONLINE_GAUCHOBASE_GAUCHO_MONCLASSMGR_H_
 #define ONLINE_GAUCHOBASE_GAUCHO_MONCLASSMGR_H_
 
-
-#include <map>
-#include <list>
+#include <memory>
 #include <string>
-#include "Gaucho/ObjMap.h"
-#include "Gaucho/MonSubSysParams.h"
+#include <map>
+#include <set>
 
 /// Online namespace declaration
 namespace Online   {
 
+  class SubSysParams;
   class MonitorClass;
-  struct MonBase;
+  class CounterSubSys;
+  class HistSubSys;
+  class MonBase;
   class ObjRPC;
-  class ObjSerializer;
-  class ObjMap;
+
   class MonClassMgr  {
+    friend class ObjSerializer;
+    friend class TaskSaveTimer;
+    friend class CounterSubSys;
+    friend class HistSubSys;
+
+  private:
+
+    std::map<std::string, std::shared_ptr<MonitorClass> > classMap;
+    std::shared_ptr<MonitorClass> getClass(const std::string& mon_name);
+
+    std::map<std::string,std::shared_ptr<MonitorClass> >& getMap()    {
+      return this->classMap;
+    }
+
 
-    std::map<std::string,MonitorClass*> m_ClassMap;
   public:
-    ObjMap         m_ObjMap;
-    ObjRPC        *m_rpc;
-    ObjSerializer *m_RPCser;
-    MonitorClass  *m_DefaultClass;
-    int   m_type;
+    std::set<MonBase*>            objects;
+    std::unique_ptr<ObjRPC>       rpc;
+    std::shared_ptr<MonitorClass> defaultClass;
+
+    int   type;
     bool  runAware = false;
 
-    MonClassMgr(SubSysParams&);
+    MonClassMgr(const SubSysParams& parameters);
     virtual ~MonClassMgr();
-    void add(MonitorClass* clazz);
-    std::map<std::string,MonitorClass*> &getMap()    {
-      return m_ClassMap;
-    }
+
+    void add(std::shared_ptr<MonitorClass>&& clazz);
+    size_t removeAll(const std::string &owner_name);
+    size_t clear();
+
     void setRunNo(int runno);
     void EORUpdate(int runo);
     void update();
     void update(unsigned long ref);
     void start();
     void stop();
-    void setDefault(SubSysParams&);
-    void setup(const std::string&,bool expandnames, const std::string &einfix, const std::string &pname);
-    void setup(const std::string&, const std::string &);
-    void registerEntry(MonBase *m);
+    void setup(const std::string& name, bool expandnames, const std::string &einfix, const std::string &pname);
+    void registerEntry(std::unique_ptr<MonBase>&& m);
+
     void unregisterEntry(const std::string &name);
     void unregisterAll();
   };
diff --git a/Online/GauchoBase/Gaucho/MonCounter.h b/Online/GauchoBase/Gaucho/MonCounter.h
index fa7e1ee8d00a564beb0337ea7a8f934f22d732e0..75909843a96d22480e474d6937c8216ca1ecfc2d 100644
--- a/Online/GauchoBase/Gaucho/MonCounter.h
+++ b/Online/GauchoBase/Gaucho/MonCounter.h
@@ -84,7 +84,7 @@ namespace Online  {
       this->m_expandService = expand;
     }
 
-    virtual int SerializeHeader(void* &ptr)    {
+    virtual int SerializeHeader(void* ptr)    {
       if (this->m_contents != 0)  {
 	DimBuffBase *b = (DimBuffBase*) ptr;
 	int hdrl   = this->hdrlen();
@@ -116,12 +116,12 @@ namespace Online  {
     MonCounter(const std::string& name, const std::string& title, const T& data);
     MONTYPE Type() const;
     unsigned int SerialSize() { return sizeof(T); }
-    int          Serialize(void* &ptr) override;
-    unsigned int SerializeData(void* &ptr,const void *src,int len);
+    int          serialize(void* ptr) override;
+    unsigned int SerializeData(void* ptr,const void *src,int len);
     void         create_OutputService(const std::string  &infix) override;
   };
 
-  template<typename T> int MonCounter<T>::Serialize(void* &ptr)    {
+  template<typename T> int MonCounter<T>::serialize(void* ptr)    {
     if ( !SerializeHeader(ptr) ) return 0;
     unsigned int retval=0;
     DimBuffBase *tptr=(DimBuffBase*)ptr;
diff --git a/Online/GauchoBase/Gaucho/MonCounterArrays.tcc.h b/Online/GauchoBase/Gaucho/MonCounterArrays.tcc.h
index fcf3a45b03cb000b0323f9531ef489a33e7e926d..b0e8a5ddf10b37831926b3bdd7b962f28756114a 100644
--- a/Online/GauchoBase/Gaucho/MonCounterArrays.tcc.h
+++ b/Online/GauchoBase/Gaucho/MonCounterArrays.tcc.h
@@ -37,8 +37,7 @@ namespace Online  {
       }
     }
 
-    unsigned int SerialSize() { return 0; }
-    int Serialize(void* &ptr) override    {
+    int serialize(void* ptr) override    {
       if ( !SerializeHeader(ptr) ) return 0;
       unsigned int retval=0;
       DimBuffBase *tptr=(DimBuffBase*)ptr;
@@ -49,7 +48,9 @@ namespace Online  {
       memcpy(m_CounterData,tptr,buffersize);
       return retval;
     }
-    unsigned int SerializeData(void *&targ, const void *src, int len) {
+
+    unsigned int SerialSize() { return 0; }
+    unsigned int SerializeData(void *targ, const void *src, int len) {
       DimBuffBase *pp = (DimBuffBase*) targ;
       void *dst = (void*)AddPtr(pp, pp->dataoff);
       memcpy(dst,src,len);
diff --git a/Online/GauchoBase/Gaucho/MonCounterAtomic.tcc.h b/Online/GauchoBase/Gaucho/MonCounterAtomic.tcc.h
index e1d2f0db7a23a476f98858cb63ba038e40af2617..8e6719e5ba9daf7a5d7e3c6cd1f89bedc3300f2a 100644
--- a/Online/GauchoBase/Gaucho/MonCounterAtomic.tcc.h
+++ b/Online/GauchoBase/Gaucho/MonCounterAtomic.tcc.h
@@ -34,11 +34,7 @@ namespace Online  {
       }
     }
 
-    unsigned int SerialSize() {
-      std::atomic<T> q;
-      return sizeof( q.load() );
-    }
-    int Serialize(void* &ptr) override    {
+    int serialize(void* ptr) override    {
       if ( !SerializeHeader(ptr) ) return 0;
       DimBuffBase *tptr = (DimBuffBase*)ptr;
       unsigned int retval = SerializeData(ptr,m_contents, m_contsiz);
@@ -46,7 +42,12 @@ namespace Online  {
       ::memcpy(m_CounterData, add_ptr<void>(tptr, tptr->dataoff), buffersize);
       return retval;
     }
-    unsigned int SerializeData(void *&targ, const void *src, int ) {
+
+    unsigned int SerialSize() {
+      std::atomic<T> q;
+      return sizeof( q.load() );
+    }
+    unsigned int SerializeData(void *targ, const void *src, int ) {
       DimBuffBase *pp = (DimBuffBase*) targ;
       long *dst = add_ptr<long>(pp, pp->dataoff);
       std::atomic<T> *s = (std::atomic<T>*)src;
diff --git a/Online/GauchoBase/Gaucho/MonCounterPair.tcc.h b/Online/GauchoBase/Gaucho/MonCounterPair.tcc.h
index 7ecfce13a64423b89e89c07e66d3d17ce9529fde..cd5161878b17448dbbce106f16dd6c59409eca7e 100644
--- a/Online/GauchoBase/Gaucho/MonCounterPair.tcc.h
+++ b/Online/GauchoBase/Gaucho/MonCounterPair.tcc.h
@@ -30,21 +30,22 @@ namespace Online  {
       }
     }
 
-    unsigned int SerialSize() {
-      return 2*sizeof(T); 
-    }
-    int Serialize(void* &ptr) override    {
+    int serialize(void* ptr) override    {
       if ( SerializeHeader(ptr) )   {
 	unsigned int retval = SerializeData(ptr, m_contents, m_contsiz);
 	if ( !(retval == 0 || m_CounterData == 0) )  {
 	  DimBuffBase *tptr = (DimBuffBase*)ptr;
-	  memcpy(m_CounterData, add_ptr<void>(tptr,tptr->dataoff), buffersize);
+	  ::memcpy(m_CounterData, add_ptr<void>(tptr,tptr->dataoff), buffersize);
 	}
 	return retval;
       }
       return 0;
     }
-    unsigned int SerializeData(void *&targ, const void *src, int) {
+
+    unsigned int SerialSize() {
+      return 2*sizeof(T); 
+    }
+    unsigned int SerializeData(void *targ, const void *src, int) {
       DimBuffBase *pp = (DimBuffBase*) targ;
       pairType*     s = (pairType*)src;
       long*         d = add_ptr<long>(pp, pp->dataoff);
diff --git a/Online/GauchoBase/Gaucho/MonCounterScalars.tcc.h b/Online/GauchoBase/Gaucho/MonCounterScalars.tcc.h
index c59222e504d90dc39a71bb038bf9aed1c52bdcce..9558b02562fc45cfeba217154213cd38970789b0 100644
--- a/Online/GauchoBase/Gaucho/MonCounterScalars.tcc.h
+++ b/Online/GauchoBase/Gaucho/MonCounterScalars.tcc.h
@@ -34,7 +34,7 @@ namespace Online  {
   template <typename T> MonCounter<T>::MonCounter(const std::string& name, const std::string& title, const T& data)
     : MonCounterBase(Type(), name, title, std::max(8u, SerialSize()), SerialSize(), (T*)&data, 0) {}
 
-  template <typename T> unsigned int MonCounter<T>::SerializeData(void *&targ, const void *src, int)    {
+  template <typename T> unsigned int MonCounter<T>::SerializeData(void *targ, const void *src, int)    {
     DimBuffBase *pp = (DimBuffBase*)targ;
     long* dst = add_ptr<long>(pp, pp->dataoff);
     *dst      = 0L;
diff --git a/Online/GauchoBase/Gaucho/MonHist.h b/Online/GauchoBase/Gaucho/MonHist.h
index 54ed78986576a488b4296b9641a57f9936e3151e..7be5910e9c29539fd125d5cbed57a1d0d19bbf16 100644
--- a/Online/GauchoBase/Gaucho/MonHist.h
+++ b/Online/GauchoBase/Gaucho/MonHist.h
@@ -174,7 +174,7 @@ namespace Online  {
       }
       return this->m_xmitbuffersize;
     }
-    virtual int Serialize(void* &ptr) override;
+    virtual int  serialize(void* ptr) override;
     virtual void clear() override ;
     virtual void create_OutputService(const std::string&) override {  }
   };
diff --git a/Online/GauchoBase/Gaucho/MonInfo.h b/Online/GauchoBase/Gaucho/MonInfo.h
index 0b51a03b094217c4cdd0afa69c9daa637add5b59..a61b0fc6eef2f3dbcafb753d3f6eefcffce4a775 100644
--- a/Online/GauchoBase/Gaucho/MonInfo.h
+++ b/Online/GauchoBase/Gaucho/MonInfo.h
@@ -11,25 +11,33 @@
 //==========================================================================
 #ifndef MonInfo_H
 #define MonInfo_H
-#include "dimhist.h"
-#include "dim/dic.hxx"
+
+#include <Gaucho/dimhist.h>
+#include <dim/dic.hxx>
+
 #include <string>
 #include <map>
 
 /// Online namespace declaration
 namespace Online  {
 
-  class MonInfo : public DIMTYPE  {
-    std::map<std::string,void*> histmap;
-    void (*AdderFn)(void*,void*,int, MonInfo *) = nullptr;
-    void *adderobj = nullptr;
+  class MonInfo;
+  class MonInfoHandler;
+
+  class MonInfoHandler   {
+  public:
+    MonInfoHandler() = default;
+    virtual ~MonInfoHandler() = default;
+    virtual void operator()(void* data, int size, MonInfo* info) = 0;
+  };
+
+  class MonInfo : public DimUpdatedInfo  {
+    MonInfoHandler* handler  { nullptr };
   public:
-    std::string targetService       {};
     virtual ~MonInfo() = default;
-    MonInfo(const std::string& target, int period);
-    MonInfo(const std::string& target, void addfn(void*,void*, int, MonInfo *), void * add);
-    MonInfo(const std::string& target, void addfn(void*,void*, int, MonInfo *), void * add, int period);
-    void infoHandler (void) override;
+    MonInfo(const std::string& target, MonInfoHandler* handler = nullptr);
+    MonInfo(const std::string& target, int period, MonInfoHandler* handler = nullptr);
+    void infoHandler () override;
     static void setShutdownInProgress(bool value);
   };
 }
diff --git a/Online/GauchoBase/Gaucho/MonRate.h b/Online/GauchoBase/Gaucho/MonRate.h
index 987baebe5597d366095208253fb5bc2d0cca91bf..d1166d7eacbc8c36b63fadceb8cd103b71b90c2c 100644
--- a/Online/GauchoBase/Gaucho/MonRate.h
+++ b/Online/GauchoBase/Gaucho/MonRate.h
@@ -25,8 +25,7 @@
 /// Online namespace declaration
 namespace Online  {
 
-  enum
-  {
+  enum  {
     R_INT, R_FLOAT, R_DOUBLE, R_STATENT
   };
 
@@ -34,7 +33,6 @@ namespace Online  {
     MonBase *m_Cntr             { nullptr };
     MonBase *m_OrigCounter      { nullptr };
 
-    //    MonRateBase(std::string name, std::string title);
     MonRateBase(const std::string&, const std::string& , MonBase *bse=0);
     virtual void create_OutputService(const std::string &s) override;
     virtual void update_OutputService() override;
@@ -53,13 +51,13 @@ namespace Online  {
 
     virtual void create_OutputService(const std::string &s) override    {
       if (m_Cntr != 0)
-	  m_Cntr->create_OutputService(s);
+	m_Cntr->create_OutputService(s);
     }
 
-  MonRateBBase(const std::string &nam, const std::string &tit, MonBase *bse=0) :
-    MonRateBase(nam, tit,bse)
+  MonRateBBase(const std::string &nam, const std::string &tit, MonBase *bse=0)
+    :  MonRateBase(nam, tit, bse)
       {
-	zeroLast(); //m_lastCount = 0;
+	zeroLast();
 	m_Cntr = CREATERate(nam, tit, m_Rate);
 	this->type = C_RATEDOUBLE;
       }
@@ -72,8 +70,8 @@ namespace Online  {
       return (m_Cntr != 0) ? m_Cntr->xmitbuffersize() : 0;
     }
     
-    virtual int Serialize(void* &buff) override   {
-      return (m_Cntr != 0) ? m_Cntr->Serialize(buff) : 0;
+    virtual int serialize(void* buff) override   {
+      return (m_Cntr != 0) ? m_Cntr->serialize(buff) : 0;
     }
   };
 
@@ -85,41 +83,37 @@ namespace Online  {
       : MonRateBBase(name, title, bse), m_data(dat)
       {
       }
-      virtual void makeRate(unsigned long dt) override
-      {
+      virtual void makeRate(unsigned long dt) override      {
 	m_Rate = double(m_data - m_lastCount);
 	m_Rate = 1.0e9 * m_Rate / double(dt);
 	if (m_Rate < 0.0)
 	  m_Rate = 0.0;
 	m_lastCount = m_data;
       }
-      virtual void zeroLast() override
-      {
+      virtual void zeroLast() override      {
 	m_lastCount = 0;
       }
-      virtual void zero() override
-      {
+      virtual void zero() override      {
 	this->zeroLast();
 	m_Rate = 0e0;
       }
     };
 
   /// specialization of MonRate for arrays
-  template<typename T> struct MonRate<T*> : MonRateBase
-    {
-      T* m_ptr;
-      T* m_lastCount;
-      double *m_ratearr;
-      int m_nel;
-      int m_arrsiz;
-      MonRate(const std::string &name, const std::string &tit, const std::string, T* dat, int siz, MonBase *bse=0);
-      virtual ~MonRate();
-      virtual int xmitbuffersize() override;
-      virtual int Serialize(void* &buff) override;
-      void makeRate(unsigned long dt) override;
-      virtual void zeroLast() override;
-      virtual void zero() override;
-    };
+  template<typename T> struct MonRate<T*> : MonRateBase    {
+    T* m_ptr;
+    T* m_lastCount;
+    double *m_ratearr;
+    int m_nel;
+    int m_arrsiz;
+    MonRate(const std::string &name, const std::string &tit, const std::string, T* dat, int siz, MonBase *bse=0);
+    virtual ~MonRate();
+    virtual int xmitbuffersize() override;
+    virtual int serialize(void* buff) override;
+    void makeRate(unsigned long dt) override;
+    virtual void zeroLast() override;
+    virtual void zero() override;
+  };
 
   /// specialization of MonRate class for atomic types
   template<typename T> struct MonRate<std::atomic<T>> : MonRateBBase
@@ -130,42 +124,36 @@ namespace Online  {
       MonRateBBase(name, title,bse), m_ptr(&dat)
 	{
 	}
-      virtual void makeRate(unsigned long dt) override
-      {
+      virtual void makeRate(unsigned long dt) override     {
 	m_Rate = double(m_ptr->load() - m_lastCount.load());
 	m_Rate = 1.0e9 * m_Rate / double(dt);
 	if (m_Rate < 0.0)
 	  m_Rate = 0.0;
 	m_lastCount.store(m_ptr->load());
       }
-      virtual void zeroLast() override
-      {
+      virtual void zeroLast() override     {
 	m_lastCount = 0;
 	m_Rate = 0e0;
       }
     };
 
   /// specialization of MonRate class for pairs
-  template<typename T> struct MonRate<std::pair<T, T>> : MonRateBBase
-    {
-    MonRate(const std::string &name, const std::string &title, const std::atomic<T> &, MonBase *bse=0) :
-      MonRateBBase(name, title,bse)
-	{
-	}
-      virtual void makeRate(unsigned long) override
-      {
-	assert(false);
-      }
-      virtual void zeroLast() override
+  template<typename T> struct MonRate<std::pair<T, T>> : MonRateBBase   {
+  MonRate(const std::string &name, const std::string &title, const std::atomic<T> &, MonBase *bse=0) :
+    MonRateBBase(name, title,bse)
       {
       }
-      virtual void zero() override
-      {
-      }
-    };
+    virtual void makeRate(unsigned long) override     {
+      assert(false);
+    }
+    virtual void zeroLast() override      {
+    }
+    virtual void zero() override      {
+    }
+  };
 
-  template<typename T> MonRate<T*>::MonRate(const std::string &name, const std::string &tit, const std::string, T* dat, int siz, MonBase *bse) :
-  MonRateBase(name, tit,bse)
+  template<typename T> MonRate<T*>::MonRate(const std::string &name, const std::string &tit, const std::string, T* dat, int siz, MonBase *bse)
+    : MonRateBase(name, tit,bse)
     {
       std::string fmt("d");
       m_ptr = dat;
@@ -185,36 +173,31 @@ namespace Online  {
       deletePtr(m_Cntr);
     }
 
-  template<typename T> int MonRate<T*>::xmitbuffersize()
-    {
-      return (m_Cntr != 0) ? m_Cntr->xmitbuffersize() : 0;
-    }
-
-  template<typename T> int MonRate<T*>::Serialize(void* &buff)
-    {
-      return (m_Cntr != 0) ? m_Cntr->Serialize(buff) : 0;
-    }
-
-  template<typename T> void MonRate<T*>::makeRate(unsigned long dt)
-    {
-      for (int i = 0; i < m_nel; i++)   {
-	long tmp = m_ptr[i] - m_lastCount[i];
-	m_ratearr[i] = (double) (tmp);
-	m_ratearr[i] = (m_ratearr[i]) / double(dt);
-	m_ratearr[i] *= 1.0e9;
-	if (m_ratearr[i] < 0.0)
-	  m_ratearr[i] = 0;
-      }
-      ::memcpy(m_lastCount, m_ptr, m_arrsiz);
+  template<typename T> int MonRate<T*>::xmitbuffersize()    {
+    return (m_Cntr != 0) ? m_Cntr->xmitbuffersize() : 0;
+  }
+
+  template<typename T> int MonRate<T*>::serialize(void* buff)    {
+    return (m_Cntr != 0) ? m_Cntr->serialize(buff) : 0;
+  }
+
+  template<typename T> void MonRate<T*>::makeRate(unsigned long dt)    {
+    for (int i = 0; i < m_nel; i++)   {
+      long tmp = m_ptr[i] - m_lastCount[i];
+      m_ratearr[i] = (double) (tmp);
+      m_ratearr[i] = (m_ratearr[i]) / double(dt);
+      m_ratearr[i] *= 1.0e9;
+      if (m_ratearr[i] < 0.0)
+	m_ratearr[i] = 0;
     }
+    ::memcpy(m_lastCount, m_ptr, m_arrsiz);
+  }
 
-  template<typename T> void MonRate<T*>::zeroLast()
-    {
-      ::memset(m_lastCount, 0, m_arrsiz);
-    }
+  template<typename T> void MonRate<T*>::zeroLast()    {
+    ::memset(m_lastCount, 0, m_arrsiz);
+  }
 
-  template<typename T> void MonRate<T*>::zero()
-    {
-      zeroLast();
-    }
+  template<typename T> void MonRate<T*>::zero()    {
+    zeroLast();
+  }
 }
diff --git a/Online/GauchoBase/Gaucho/MonSubSys.h b/Online/GauchoBase/Gaucho/MonSubSys.h
index 8bb63df42dd11c002b305bd7b2df5e45885aa6b0..0d375e8195299ce062ce756f2603074ba28d1c34 100644
--- a/Online/GauchoBase/Gaucho/MonSubSys.h
+++ b/Online/GauchoBase/Gaucho/MonSubSys.h
@@ -11,22 +11,33 @@
 //==========================================================================
 #pragma once
 
-#include "Gaucho/ObjMap.h"
-#include "Gaucho/MonSubSysTypes.h"
-#include "Gaucho/BRTL_Lock.h"
-#include "Gaucho/MonClassMgr.h"
-#include "Gaucho/MonSubSysParams.h"
-#include "RTL/rtl.h"
+#include <Gaucho/BRTL_Lock.h>
+#include <Gaucho/MonClassMgr.h>
 
-#include <map>
 #include <list>
-#include <string>
 
 /// Online namespace declaration
 namespace Online   {
 
   class MonitorClass;
 
+  enum    {
+    MONSUBSYS_Histogram = 1,
+    MONSUBSYS_Counter,
+    MONSUBSYS_String
+  };
+
+  class SubSysParams    {
+  public:
+    bool        expandnames;
+    bool        dontclear;
+    std::string expandInfix;
+    std::string ratePrefix;
+    int         type;
+    int         updatePeriod;
+    bool        runAware=false;
+  };
+
   class MonSubSys  {
   public:
     struct _Lock {
@@ -39,15 +50,13 @@ namespace Online   {
 	if (m_dolock) m_sys->unlock();
       }
     };
-    std::map<std::string,MonitorClass*> classMap;
-    MonClassMgr  classMgr;
-    ObjMap       objMap;
-    int          type               { 0 };
-    int          runNumber          { 0 };
-    bool         dontclear          { false };
+    MonClassMgr    classMgr;
+    int            type               { 0 };
+    int            runNumber          { 0 };
+    bool           dontclear          { false };
+
   protected:
     std::string  name;
-    std::string  pname;
     BRTLLock     lockid;
     int          numObjs            { 0 };
     int          lockcount          { 0 };
@@ -58,22 +67,21 @@ namespace Online   {
     MonSubSys(SubSysParams & params);
     virtual ~MonSubSys();
     virtual void setup(const std::string& n, bool expand=false)=0;
-    virtual void start();
-    virtual void add(MonBase *h);
-    void removeObj(MonBase *h);
-    virtual void remove(const std::string &name) = 0;
-    virtual MonBase *findobj(const std::string& name) final;
-    virtual MonBase *findEntity(const std::string& name)  final;
-    virtual void setRunNo(int runno);
-    virtual void clear(const std::string& name);
-    virtual void clear();
-    virtual void EORUpdate(int runo);
-    virtual void update();
-    virtual void update(unsigned long ref);
     virtual int  lock(void);
     virtual int  unlock(void);
+
+    virtual void start();
     virtual void stop();
-    void         AddClass(std::string &nam, int intv, std::list<std::string> &sels);
-    void         AddClass(MonitorClass *);
+    virtual void update();
+    virtual void update(unsigned long ref);
+
+    virtual size_t remove(const std::string &name) = 0;
+    virtual size_t removeAll(const std::string &owner_name);
+    virtual void clear();
+
+    virtual void setRunNo(int runno);
+    virtual void EORUpdate(int runo);
+    void         addClass(std::string &nam, int intv, std::list<std::string> &sels);
+    void         addClass(std::shared_ptr<MonitorClass>&& clazz);
   };
 }
diff --git a/Online/GauchoBase/Gaucho/MonSubSysParams.h b/Online/GauchoBase/Gaucho/MonSubSysParams.h
deleted file mode 100644
index bcca20dd8f9affce552b698f2bc8f6968f2a3c64..0000000000000000000000000000000000000000
--- a/Online/GauchoBase/Gaucho/MonSubSysParams.h
+++ /dev/null
@@ -1,29 +0,0 @@
-//==========================================================================
-//  LHCb Online software suite
-//--------------------------------------------------------------------------
-// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
-// All rights reserved.
-//
-// For the licensing terms see OnlineSys/LICENSE.
-//
-// Author     : B.Jost
-//
-//==========================================================================
-#ifndef ONLINE_GAUCHOBASE_GAUCHO_MONSUBSYSPARAMS_H_
-#define ONLINE_GAUCHOBASE_GAUCHO_MONSUBSYSPARAMS_H_
-
-#include <string>
-
-class SubSysParams    {
-  public:
-    bool        expandnames;
-    bool        dontclear;
-    std::string expandInfix;
-    std::string ratePrefix;
-    int         type;
-    int         updatePeriod;
-    bool        runAware=false;
-};
-
-
-#endif /* ONLINE_GAUCHOBASE_GAUCHO_MONSUBSYSPARAMS_H_ */
diff --git a/Online/GauchoBase/Gaucho/MonSubSysTypes.h b/Online/GauchoBase/Gaucho/MonSubSysTypes.h
deleted file mode 100644
index d61f848571563de95192561f9fbe239e3cc45d63..0000000000000000000000000000000000000000
--- a/Online/GauchoBase/Gaucho/MonSubSysTypes.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//==========================================================================
-//  LHCb Online software suite
-//--------------------------------------------------------------------------
-// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
-// All rights reserved.
-//
-// For the licensing terms see OnlineSys/LICENSE.
-//
-// Author     : B.Jost
-//
-//==========================================================================
-/*
- * MonSubSysTypes.h
- *
- *  Created on: May 16, 2019
- *      Author: beat
- */
-
-#ifndef ONLINE_GAUCHOBASE_GAUCHO_MONSUBSYSTYPES_H_
-#define ONLINE_GAUCHOBASE_GAUCHO_MONSUBSYSTYPES_H_
-
-
-enum
-{
-  MONSUBSYS_Histogram = 1,
-  MONSUBSYS_Counter,
-  MONSUBSYS_String
-};
-
-
-
-#endif /* ONLINE_GAUCHOBASE_GAUCHO_MONSUBSYSTYPES_H_ */
diff --git a/Online/GauchoBase/Gaucho/MonSys.h b/Online/GauchoBase/Gaucho/MonSys.h
index bf29cacdd7f9dad381575aa8e9da8d3ce1e21521..52b883bd6708cace7600e78cc0f0514dea4b16d2 100644
--- a/Online/GauchoBase/Gaucho/MonSys.h
+++ b/Online/GauchoBase/Gaucho/MonSys.h
@@ -14,6 +14,7 @@
 
 #include <vector>
 #include <string>
+#include <memory>
 
 /// Online namespace declaration
 namespace Online   {
@@ -24,13 +25,13 @@ namespace Online   {
   public:
     std::string name;
     std::string state;
-    std::vector<MonSubSys*> subSystems;
+    std::vector<std::shared_ptr<MonSubSys> > subSystems;
 
   public:
     MonSys();
     virtual ~MonSys() = default;
-    void add(MonSubSys* subsys);
-    void remove(MonSubSys* subsys);
+    void add(std::shared_ptr<MonSubSys> subsys);
+    void remove(std::shared_ptr<MonSubSys> subsys);
     void lock();
     void unlock();
     static MonSys& instance();
diff --git a/Online/GauchoBase/Gaucho/MonTimer.h b/Online/GauchoBase/Gaucho/MonTimer.h
index a02b76b17da3aac3b12acdd093878c244a442271..8ecc638af78d8cb3fda6c1166e9ebcd47894fa79 100644
--- a/Online/GauchoBase/Gaucho/MonTimer.h
+++ b/Online/GauchoBase/Gaucho/MonTimer.h
@@ -20,14 +20,12 @@ namespace Online   {
 
   class MonitorClass;
 
-  class MonTimer : public GenTimer
-  {
-    MonitorClass *m_Hsys;
+  class MonTimer : public GenTimer    {
+    MonitorClass *m_Hsys { nullptr };
   public:
     MonTimer(MonitorClass *tis, int period = 10);
-    virtual ~MonTimer(void);
-    void timerHandler ( void ) override;
-    void stop()   override;
+    virtual ~MonTimer() = default;
+    void timerHandler() override;
   };
 }
 #endif  // ONLINE_GAUCHO_MONTIMER_H
diff --git a/Online/GauchoBase/Gaucho/MonTypes.h b/Online/GauchoBase/Gaucho/MonTypes.h
index ebaf049bc35c71a5568915d29dc64d9da962d6a8..edf8ce2d10ec675022865687a2940c996a932eb7 100644
--- a/Online/GauchoBase/Gaucho/MonTypes.h
+++ b/Online/GauchoBase/Gaucho/MonTypes.h
@@ -9,11 +9,10 @@
 // Author     : B.Jost
 //
 //==========================================================================
-#ifndef MONTYPES_H
-#define MONTYPES_H
+#ifndef GAUCHO_MONTYPES_H
+#define GAUCHO_MONTYPES_H
 
-enum MONTYPE
-{
+enum MONTYPE   {
   H_ILLEGAL = 0xFEED0000,
   H_1DIM,
   H_2DIM,
@@ -63,4 +62,5 @@ enum MONTYPE
   C_GAUDIACCuLONG,
   C_GAUDIACCuINT
 };
+
 #endif
diff --git a/Online/GauchoBase/Gaucho/MonitorClass.h b/Online/GauchoBase/Gaucho/MonitorClass.h
index 663dff8b6f3a10636263969c6a8b1b224e21012d..e55947a519df238d1c6f66a426253a8402f3cecd 100644
--- a/Online/GauchoBase/Gaucho/MonitorClass.h
+++ b/Online/GauchoBase/Gaucho/MonitorClass.h
@@ -9,68 +9,49 @@
 // Author     : B.Jost
 //
 //==========================================================================
-/*
- * MonitorClass.h
- *
- *  Created on: Feb 12, 2019
- *      Author: beat
- */
 #ifndef ONLINE_GAUCHOBASE_GAUCHO_MONITORCLASS_H_
 #define ONLINE_GAUCHOBASE_GAUCHO_MONITORCLASS_H_
+
+#include <Gaucho/BRTL_Lock.h>
+#include <Gaucho/ObjMap.h>
+
 #include <list>
 #include <set>
 #include <map>
 #include <string>
 #include <regex>
-#include "RTL/rtl.h"
-#include "Gaucho/ObjService.h"
-#include "Gaucho/MonTimer.h"
-#include "Gaucho/ObjSerializer.h"
-#include "Gaucho/MonBase.h"
-#include "Gaucho/ObjMap.h"
-#include "Gaucho/ObjRPC.h"
 
 /// Online namespace declaration
 namespace Online  {
 
   struct MonBase;
+  class ObjRPC;
   class RateMgr;
+  class MonTimer;
+  class ObjService;
+  class Serializer;
+
   class MonitorClass  {
   public:
     static std::string DefaultClassName;
     struct _Lock {
       MonitorClass* m_class;
-      bool m_dolock;
-    _Lock(MonitorClass* sys,bool dolock=true) : m_class(sys),m_dolock(dolock)
-      {
-        if (m_dolock) m_class->Lock();
-      }
-      ~_Lock()
-      {
-        if (m_dolock) m_class->unLock();
-      }
+    _Lock(MonitorClass* sys) : m_class(sys)  {  m_class->Lock();  }
+      ~_Lock()  {  m_class->unLock();   }
     };
-    BRTLLock m_lockid;
-    int Lock(void)
-    {
+
+    int Lock(void)    {
       int status = 1;
       while (status != 0)
 	{
 	  //    printf("Locking subsustem %s\n",m_name.c_str());
-	  status = m_lockid.lockMutex();
+	  status = this->lockid.lockMutex();
 	  if (status != 0)
 	    {
 	      //      printf("Status from lock not success......\n");
 	    }
 	  //    printf("Locking subsustem %s Done...............\n",m_name.c_str());
 	}
-      //      m_lockcnt++;
-      //      m_lockcount++;
-      //      if (m_lockcnt != 1)
-      //      {
-      //    //    printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!Lock Counter != 1 after locking %d %d %d\n",m_lockcnt,m_lockcount,m_unlockcount);
-      //      }
-      //    //  printf("+++++++++++Monitor Sub System LockED. Lock Address %0X\n",m_lockid);
       return status;
     }
     int unLock(void)
@@ -82,7 +63,7 @@ namespace Online  {
       while (status != 0)
 	{
 	  //    printf("UNLocking subsustem %s\n",m_name.c_str());
-	  status = m_lockid.unlockMutex();
+	  status = this->lockid.unlockMutex();
 	  if (status != 0)
 	    {
 	      //      printf("Status from unlock not success......\n");
@@ -94,50 +75,50 @@ namespace Online  {
     }
 
   protected:
-    std::string m_ServiceFMT = "";
-    ObjSerializer *m_ser        { nullptr  };
-    ObjSerializer *m_EoRRPCser  { nullptr  };
-    ObjSerializer *m_EORser     { nullptr  };
-    ObjService    *m_EORsvc     { nullptr  };
-    MonTimer      *timer        { nullptr  };
-    int m_interval;
-  public:
+    std::string                    expandInfix;
+    std::string                    serviceFMT = "";
+    std::shared_ptr<Serializer>    serializer;
+    std::shared_ptr<Serializer>    eor_serializer;
+    std::unique_ptr<ObjService>    eor_service;
+    std::unique_ptr<MonTimer>      timer;
+    BRTLLock                       lockid;
+    int                            interval { 0 };
 
-    static std::map<std::string,MonitorClass*> ClassMap;
-    int  type;
-    unsigned int m_runno;
-    std::string ID, name, pname;
-    std::string expandInfix;
-    bool expandnames;
-    bool runAware=false;
+  public:
 
-    MonTimer      *updateTimer  { nullptr  };
-    RateMgr       *rateManager  { nullptr };
-    ObjService    *m_genSrv     { nullptr  };
+    std::string                    ID, name;
+    std::unique_ptr<RateMgr>       rateManager;
+    std::unique_ptr<ObjService>    genSrv;
+    std::list<std::string>         entityExpression;
+    std::list<std::regex*>         m_Cregex;
+    MonitorObjects                 entities;
+    MonTimer                      *updateTimer  { nullptr  };
+    int                            type         { 0 };
+    unsigned int                   runNumber    { 0 };
+    bool                           expand       { false };
+    bool                           runAware     { false };
 
-    std::list<std::string> entityExpression;
-    std::list<std::regex*> m_Cregex;
-    ObjMap   entities;
 
     MonitorClass(const std::string &id, int intv, std::list<std::string> &sel);
     virtual ~MonitorClass();
-    void add(MonBase* m);
-    MonBase *remove(const std::string &nam);
+
+    void add(std::unique_ptr<MonBase>&& mon);
+    std::unique_ptr<MonBase> remove(const std::string &nam);
+    size_t clear();
+    size_t clearAll(const std::string &owner_name);
+
     bool matchName(const std::string &nam);
-    void setup(const std::string& n, bool expandnames, const std::string &einfix);
-    MonitorClass *GetClass(const std::string &id);
+
+    void setup(const std::string& n, bool expnd, const std::string &einfix);
     void makeRates(unsigned long);
-    void setType(int t)    {
-      this->type = t;
-    }
+    //void setType(int t);
     void start();
     void stop();
     void setRunNo(unsigned int runno);
     void EORUpdate(int runo);
     void update();
     void update(unsigned long ref);
-    void addRateMgr(RateMgr *);
-    void configure(int);
+    void configure(int typ);
   };
 }
 #endif /* ONLINE_GAUCHOBASE_GAUCHO_MONITORCLASS_H_ */
diff --git a/Online/GauchoBase/Gaucho/MonitorInterface.h b/Online/GauchoBase/Gaucho/MonitorInterface.h
index 13884abad11d25cb23a38fe0811ee2ee8b5fa78e..dc170756b8d74c21efc007b23f452c23bb36d8a6 100644
--- a/Online/GauchoBase/Gaucho/MonitorInterface.h
+++ b/Online/GauchoBase/Gaucho/MonitorInterface.h
@@ -9,19 +9,11 @@
 // Author     : B.Jost
 //
 //==========================================================================
-/*
- * MonitorInterface.h
- *
- *  Created on: Sep 24, 2019
- *      Author: beat
- */
 #pragma once
 
-#include "Gaucho/MonSubSysParams.h"
-#include "Gaucho/MonSubSysTypes.h"
-#include "Gaucho/CounterSubSys.h"
-#include "Gaucho/HistSubSys.h"
-#include "Gaucho/RateMgr.h"
+#include <Gaucho/CounterSubSys.h>
+#include <Gaucho/HistSubSys.h>
+#include <RTL/rtl.h>
 
 #include <map>
 #include <set>
@@ -40,35 +32,34 @@ namespace Online   {
   /// Forward declarations
   class MonSys;
   class MonSubSys;
+  class CounterSubSys;
+  class HistSubSys;
   class RateMgr;
   class TaskSaveTimer;
 
   class MonitorInterface  {
+
   public:
-    std::map<std::string, MonSubSys*> m_InfoMap          { };
     std::vector<std::string>       m_CounterClasses   { };
     std::vector<std::string>       m_HistogramClasses { };
     SubSysParams                   m_CntrPars         { };
     SubSysParams                   m_HistPars         { };
     std::string                    m_UTGID            { };
     std::string                    m_ServiceInfix     { };
-    std::unique_ptr<HistSubSys>    m_HistSubSys       { };
-    std::unique_ptr<CounterSubSys> m_CntrSubSys       { };
-    MonSys                        *m_MonSys           { 0 };
-    RateMgr                       *m_RateMgr          { 0 };
-    TaskSaveTimer                 *m_savetimer        { 0 };
-    int                            m_MonSSysSize      { 0 };
+    std::shared_ptr<HistSubSys>    m_HistSubSys       { };
+    std::shared_ptr<CounterSubSys> m_CntrSubSys       { };
+    std::unique_ptr<TaskSaveTimer> m_saveTimer        { };
     int                            m_runnr            { 0 };
-    int                            m_monsysrecover    { 0 };
     bool                           m_expandSrv        { false };
     bool                           m_started          { false };
     bool                           m_runAware         { false };
 
+  private:
+    std::list<std::shared_ptr<MonitorClass> > makeClassList(std::vector<std::string> &option) const;
+
   public:
     MonitorInterface(const std::string &utgid, SubSysParams&& cntpars, SubSysParams&& histpars);
     virtual ~MonitorInterface();
-    void MakeClassList(std::list<MonitorClass*> &target,
-		       std::vector<std::string> &option);
 
     void i_unsupported(const std::string& name, const std::type_info& typ);
     template<class T>
@@ -83,8 +74,9 @@ namespace Online   {
     template<typename T>
       void i_declarePair(const std::string& name, const T& var1,  const T& var2, const std::string& desc);
   
-    void undeclare(const std::string&);
-    void undeclareAll(std::string &);
+    size_t undeclare(const std::string&);
+    size_t undeclareAll(std::string &);
+
     int start();
     int stop();
     void ApplyCouterClasses(std::vector<std::string> &m_CounterClasses);
@@ -102,37 +94,28 @@ namespace Online   {
   template<class T>
     void MonitorInterface::i_declareCounter(const std::string& nam, T const & var, const std::string& desc)   {
       m_CntrSubSys->add_counter<T>(nam,desc,var);
-      m_InfoMap.emplace(nam,m_CntrSubSys.get());
     }
 
   template<typename T> 
     void MonitorInterface::i_declareCounter(const std::string& nam, const std::string& format, T var,
-					    int size, const std::string& desc)
-    {
+					    int size, const std::string& desc)  {
       ::lib_rtl_output(LIB_RTL_INFO,"MonitorInterface i_declareCounter %s %s\n",
 		       nam.c_str(),typeid(var).name());
       m_CntrSubSys->add_counter<T>(nam,desc,format,var,size);
-      m_InfoMap.emplace(nam,m_CntrSubSys.get());
     }
 
   template <class T>
-    void MonitorInterface::i_declareHistogram(const std::string& nam, T* var, const std::string& desc)
-    {
+    void MonitorInterface::i_declareHistogram(const std::string& nam, T* var, const std::string& desc)   {
       m_HistSubSys->add_hist(nam,desc,(const T&)*var);
-      m_InfoMap.emplace(nam,m_HistSubSys.get());
     }
 
   template <class T>
-    void MonitorInterface::i_declareHistogram(const std::string& nam, T& var, const std::string& desc)
-    {
+    void MonitorInterface::i_declareHistogram(const std::string& nam, T& var, const std::string& desc)   {
       m_HistSubSys->add_hist(nam,desc,(const T&)var);
-      m_InfoMap.emplace(nam,m_HistSubSys.get());
     }
 
   template<typename T>
-    void MonitorInterface::i_declarePair(const std::string& nam,  const T& var1, const T& var2, const std::string& desc)
-    {
+    void MonitorInterface::i_declarePair(const std::string& nam,  const T& var1, const T& var2, const std::string& desc)   {
       m_CntrSubSys->add_counter(nam,desc,var1,var2);
-      m_InfoMap.emplace(nam,m_CntrSubSys.get());
     }
 }
diff --git a/Online/GauchoBase/Gaucho/ObjMap.h b/Online/GauchoBase/Gaucho/ObjMap.h
index e1b8dfeb900948c2050b790b7354791fdbaaa991..d78f2f2a848d8dcad1185c51d856b9181d8c448a 100644
--- a/Online/GauchoBase/Gaucho/ObjMap.h
+++ b/Online/GauchoBase/Gaucho/ObjMap.h
@@ -12,6 +12,7 @@
 #ifndef SOURCE_DIRECTORY__ONLINE_GAUCHO_GAUCHO_OBJMAP_H_
 #define SOURCE_DIRECTORY__ONLINE_GAUCHO_GAUCHO_OBJMAP_H_
 
+#include <memory>
 #include <string>
 #include <map>
 
@@ -19,8 +20,7 @@
 namespace Online   {
 
   struct MonBase;
-  class ObjMap : public std::map<std::string,MonBase*>  {};
-  typedef ObjMap::iterator SysIter;
+  typedef std::map<std::string,std::unique_ptr<MonBase> >  MonitorObjects;
 }
 
 #endif /* SOURCE_DIRECTORY__ONLINE_GAUCHO_GAUCHO_OBJMAP_H_ */
diff --git a/Online/GauchoBase/Gaucho/ObjRPC.h b/Online/GauchoBase/Gaucho/ObjRPC.h
index d8cb6def69ae66112a033859adf8b1ffda0fdc7e..06d438c3e2e8198acc384b374d0618dc0b6a56cc 100644
--- a/Online/GauchoBase/Gaucho/ObjRPC.h
+++ b/Online/GauchoBase/Gaucho/ObjRPC.h
@@ -13,27 +13,26 @@
 #define OBJRRPC_H
 #include "dim/dis.hxx"
 #include "Gaucho/RPCdefs.h"
-#include "Gaucho/ObjSerializer.h"
+#include "Gaucho/Serializer.h"
 #include "Gaucho/BRTL_Lock.h"
 
+#include <memory>
+
 /// Online namespace declaration
 namespace Online   {
 
-  class ObjRPC : public DimRpc
-  {
+  class ObjRPC : public DimRpc    {
   protected:
-    int buffersize;
-    void *buffer;
-    ObjSerializer *s;
-    BRTLLock *m_maplockid;
-    BRTLLock *m_objlockid;
+    std::shared_ptr<DimServerDns>  dns;
+    std::unique_ptr<Serializer>    serializer;
+    BRTLLock *maplock  { nullptr };
+    BRTLLock *objlock  { nullptr };
+
   public:
-    ObjRPC();
-    ObjRPC(ObjSerializer* serial, const std::string& name, const char *f_in, const char *f_out);
-    ObjRPC(ObjSerializer* serial, const std::string& name, const char *f_in, const char *f_out, BRTLLock*, BRTLLock *);
-    ObjRPC(DimServerDns *,ObjSerializer* serial, const std::string& name, const char *f_in, const char *f_out);
-    ObjRPC(DimServerDns *,ObjSerializer* serial, const std::string& name, const char *f_in, const char *f_out, BRTLLock*, BRTLLock *);
-    ~ObjRPC();
+    ObjRPC() = delete;
+    ObjRPC(std::unique_ptr<Serializer>&& serial, const std::string& name, const char *f_in, const char *f_out, BRTLLock* = nullptr, BRTLLock * = nullptr);
+    ObjRPC(std::shared_ptr<DimServerDns> dns,std::unique_ptr<Serializer>&& serial, const std::string& name, const char *f_in, const char *f_out, BRTLLock* = nullptr, BRTLLock * = nullptr);
+    virtual ~ObjRPC() = default;
     void rpcHandler() override;
   };
 }
diff --git a/Online/GauchoBase/Gaucho/ObjSerializer.h b/Online/GauchoBase/Gaucho/ObjSerializer.h
index 3dc99db2b19f1f47d3bdd0b441c6f4b121b6105d..94e67ec989c9f350d84cda0ee82f721fa163d826 100644
--- a/Online/GauchoBase/Gaucho/ObjSerializer.h
+++ b/Online/GauchoBase/Gaucho/ObjSerializer.h
@@ -10,35 +10,36 @@
 //
 //==========================================================================
 #pragma once
-#include <vector>
-#include "Gaucho/ObjMap.h"
-
-class DimServerDns;
+#include <Gaucho/mem_buff.h>
+#include <Gaucho/Serializer.h>
 
 /// Online namespace declaration
 namespace Online  {
 
-  class ObjSerializer  {
-  public:
-    size_t        buffersize       { 0 };
-    void         *buffer           { nullptr };
-    ObjMap       *m_objmap         { nullptr };
-    DimServerDns *m_dns            { nullptr };
-    std::string   m_expandPrefix;
-    bool          expand           { false };
+  class MonBase;
+  class MonClassMgr;
+  class MonitorClass;
+
+  class ObjSerializer : public Serializer {
+  private:
+    mem_buff        buffer           {  };
+    MonClassMgr*    manager          { nullptr };
+    MonitorClass*   monitorClass     { nullptr };
+    bool            expand           { false };
+
+    std::vector<MonBase*> collect()   const;
+    MonBase* find(const std::string& name)  const;
 
   public:
-    ObjSerializer() = default;
-    ObjSerializer(ObjMap *ObjMap, bool expand=false);
-    virtual ~ObjSerializer();
-    void *Allocate(size_t siz);
-    virtual void    *SerializeObj(void * &ptr, size_t& siz, bool clear=false);
-    virtual void    *SerializeObj(char *name, void * &ptr, size_t& siz, bool clear=false);
-    virtual void    *SerializeObj(std::vector<std::string> &nams, void * &ptr, size_t& siz, bool clear=false);
-    virtual void    *SerializeDir(void *&ptr, size_t& siz);
-    virtual void     DeSerializeObj(char *name, void *&ptr);
-    virtual void     DeSerializeObj(std::vector<std::string> &nams, void *&ptr);
-    virtual MonBase *findobj(const std::string& name);
-    virtual void     updateExpansions(void);
+    ObjSerializer(MonClassMgr* mgr, bool expand);
+    ObjSerializer(MonitorClass* clazz, bool expand);
+    virtual ~ObjSerializer() = default;
+
+    virtual std::pair<size_t,void*> serialize_obj(size_t offset, bool clear=false)   override;
+    virtual std::pair<size_t,void*> serialize_obj(const std::string& name, size_t offset, bool clear=false)   override;
+    virtual std::pair<size_t,void*> serialize_obj(const std::vector<std::string> &nams, size_t offset, bool clear=false)   override;
+    virtual std::pair<size_t,void*> serialize_dir(size_t offset)   override;
+    virtual std::pair<size_t,const void*> data()   const   override;
+    virtual void updateExpansions()   override;
   };
 }
diff --git a/Online/GauchoBase/Gaucho/ObjService.h b/Online/GauchoBase/Gaucho/ObjService.h
index 7aa33b561ed3a8632311201a74fd27f91b9651a1..66bbf143d9c960cafc89147f67834217c84e4a9a 100644
--- a/Online/GauchoBase/Gaucho/ObjService.h
+++ b/Online/GauchoBase/Gaucho/ObjService.h
@@ -12,41 +12,43 @@
 #ifndef ObjService_h
 #define ObjService_h
 
-#include <string>
 #include <memory>
 #include <dim/dis.hxx>
+#include <Gaucho/mem_buff.h>
+#include <Gaucho/Serializer.h>
 #include <Gaucho/SerialHeader.h>
 
 /// Online namespace declaration
 namespace Online  {
 
-  class ObjSerializer;
-
-  class ObjService : public DimService
-  {
+  class ObjService : public DimService  {
   protected:
-    void  **m_buffer         { nullptr };
-    size_t *m_buffersize     { nullptr };
-    bool    m_extBuffer      { false };
-    bool    m_EORservice     { false };
-    SerialHeader m_hdr       {};
-    void  *m_serptr          { nullptr };
-    size_t m_sersiz          { 0 };
+    std::unique_ptr<Serializer>    serializer;
+    std::shared_ptr<mem_buff>      extBuffer;
+    std::unique_ptr<DimService>    num_update_svc;
+
+    bool         m_EORservice      { false };
+    SerialHeader m_hdr             {   };
+    void        *m_serptr          { nullptr };
+    size_t       m_sersiz          { 0 };
+    int          num_updates       { 0 };
+    void add_updater(DimServerDns* dns=nullptr);
+
   public:
-    std::unique_ptr<ObjSerializer> serializer;
-    bool expand;
     ObjService () = default;
     virtual ~ObjService() = default;
-    ObjService (DimServerDns *dns,ObjSerializer *,const std::string& name, const char *format, void *buff, size_t siz);
-    ObjService (DimServerDns *dns,ObjSerializer *,const std::string& name, const char *format, void *buff, size_t siz, void **extbuff, size_t *extbufs);
-    ObjService (ObjSerializer *,const std::string& name, const char *format, void *buff, size_t siz);
-    ObjService (ObjSerializer *,const std::string& name, const char *format, void *buff, size_t siz, void **extbuff, size_t *extbufs);
+    ObjService (std::shared_ptr<DimServerDns>& dns, std::unique_ptr<Serializer>&& s,const std::string& name, const char *format, void *buff, size_t siz);
+    ObjService (std::shared_ptr<DimServerDns>& dns, std::unique_ptr<Serializer>&& s,const std::string& name, const char *format, void *buff, size_t siz, std::shared_ptr<mem_buff> extbuff);
+    ObjService (std::unique_ptr<Serializer>&& s,const std::string& name, const char *format, void *buff, size_t siz);
+    ObjService (std::unique_ptr<Serializer>&& s,const std::string& name, const char *format, void *buff, size_t siz, std::shared_ptr<mem_buff> extbuff);
 
-    void Serialize(int updtIntv);
-    void Update();
+    void serialize(int updtIntv);
+    void update();
     void setRunNo(int runno){long r = 0;r=runno;m_hdr.run_number=r;};
     void setTime(long tim){m_hdr.ser_tim=tim;};
     void setEORflag(bool val);
+    const void* serialized_buffer()   const;
+    size_t serialized_size()   const;
   };
 }
 #endif
diff --git a/Online/GauchoBase/Gaucho/RPCRec.h b/Online/GauchoBase/Gaucho/RPCRec.h
index f492fa5dfda1e8320e133df00b3aa7522acc1100..6a9659a522a335011ed2f7b22ca2b33746d65980 100644
--- a/Online/GauchoBase/Gaucho/RPCRec.h
+++ b/Online/GauchoBase/Gaucho/RPCRec.h
@@ -21,8 +21,7 @@
 /// Online namespace declaration
 namespace Online   {
 
-  class RPCRec : public DimRpcInfo
-  {
+  class RPCRec : public DimRpcInfo   {
   public:
     typedef  std::vector<char*>       NAMEVEC;
     typedef  std::vector<std::string> STRVEC;
@@ -35,7 +34,7 @@ namespace Online   {
     PTRMAP  hists;
     void rpcInfoHandler() override;
     RPCRec(const char *name, int timeout,bool synch=false); // : DimRpcInfo(name, timeout, -1)
-    virtual ~RPCRec();
+    virtual ~RPCRec() = default;
     void (*DirCB)(NAMEVEC&);
     void (*DatCB)(PTRMAP&);
     void declareDirCB(void CBfn(NAMEVEC&)){DirCB = CBfn;return;};
diff --git a/Online/GauchoBase/Gaucho/RateMgr.h b/Online/GauchoBase/Gaucho/RateMgr.h
index fc7b92c80c1183f71858723b31c6acc5cfe92879..e4e7fb1ebb0f609abd694d841cc38e0a23e6efb1 100644
--- a/Online/GauchoBase/Gaucho/RateMgr.h
+++ b/Online/GauchoBase/Gaucho/RateMgr.h
@@ -12,74 +12,25 @@
 #ifndef GAUCHO_RATEMGR_H
 #define GAUCHO_RATEMGR_H 1
 
-#include "Gaucho/MonRate.h"
-#include "Gaucho/MonSubSys.h"
-
-#include <map>
+#include <string>
 
 /// Online namespace declaration
 namespace Online  {
 
-  class RateMgr
-  {
-  public:
-    unsigned long m_deltaT;
-
-  protected:
-    typedef std::map<const std::string, MonRateBase*>  RateMap;
-    typedef std::map<const std::string, MonRateBase*>::iterator Rateit;
+  class MonitorClass;
 
-    RateMap m_rateMap;
+  class RateMgr  {
+  public:
+    unsigned long deltaT = 0;
+  private:
+    MonitorClass* monClass { nullptr };
   public:
 
-    RateMgr(const std::string& source, int version=0);
-    virtual ~RateMgr();
-    const RateMap& mapping() const   
-    {
-      return m_rateMap;
-    }
-
-    void addRate(const std::string& countName,  MonRateBase& count)
-    {
-      m_rateMap[countName] = &count;
-    }
-
-    MonRateBase* removeRate (const std::string &name)
-    {
-      Rateit rateMapIt = m_rateMap.find(name);
-      if (rateMapIt != m_rateMap.end())
-	{
-	  MonRateBase *p = rateMapIt->second;
-	  m_rateMap.erase(rateMapIt);
-	  return p;
-	}
-      return 0;
-    }
-
-    void removeRateAll (MonSubSys *s, bool del=true)
-    {
-      if (del)
-	{
-	  Rateit rateMapIt = m_rateMap.begin();
-	  while (rateMapIt != m_rateMap.end())
-	    {
-	      MonRateBase *p = rateMapIt->second;
-	      m_rateMap.erase(rateMapIt);
-	      s->removeObj(p->m_Cntr);
-	      delete p;
-	      rateMapIt = m_rateMap.begin();
-	    }
-	}
-      else
-	{
-	  m_rateMap.clear();
-	}
-    }
-
+    RateMgr(MonitorClass* cl);
+    virtual ~RateMgr() = default;
     void zero();
     void makeRates(unsigned long dt);
-    void print();
-    void CreateOutputServices(std::string infix);
+    void CreateOutputServices(const std::string& infix);
   };
 }
 
diff --git a/Online/GauchoBase/Gaucho/RootHists.h b/Online/GauchoBase/Gaucho/RootHists.h
index 7a286280a2d8a935db94d37a05f51d4fa0d6a859..93c4198463d889ce5ff0db4ed6d29adb9ae2f035 100644
--- a/Online/GauchoBase/Gaucho/RootHists.h
+++ b/Online/GauchoBase/Gaucho/RootHists.h
@@ -34,32 +34,26 @@ namespace Online   {
       ::memset(to, 0, len);
   }
 
-  class MyTH1D : public TH1D
-  {
+  class MyTH1D : public TH1D  {
   public:
     using TH1D::TH1D;
     friend class MonHist<const ::AIDA::IHistogram1D>;
     friend class HistSerDes;
     double *GetEntryArr(void){return fArray;};
     double *GetSumw2Arr(void){return GetSumw2()->GetArray();};
-    void movetodimbuffer(void *base)
-    {
+    void movetodimbuffer(void *base)   {
       int blocksize = GetNcells()*sizeof(double);
-      copy_data(AddPtr(base,0*blocksize),GetEntryArr(),blocksize);
-      copy_data(AddPtr(base,1*blocksize),GetSumw2Arr(),blocksize);
-      return;
+      copy_data(add_ptr(base,0*blocksize),GetEntryArr(),blocksize);
+      copy_data(add_ptr(base,1*blocksize),GetSumw2Arr(),blocksize);
     }
-    void movefromdimbuffer(void *base)
-    {
+    void movefromdimbuffer(const void *base)    {
       int blocksize = GetNcells()*sizeof(double);
-      memcpy(GetEntryArr(),AddPtr(base,0*blocksize),blocksize);
-      memcpy(GetSumw2Arr(),AddPtr(base,1*blocksize),blocksize);
-      return;
+      memcpy(GetEntryArr(),add_ptr(base,0*blocksize),blocksize);
+      memcpy(GetSumw2Arr(),add_ptr(base,1*blocksize),blocksize);
     }
   };
 
-  class MyTProfile : public TProfile
-  {
+  class MyTProfile : public TProfile  {
   public:
     using TProfile::TProfile;
     friend class MonHist<const ::AIDA::IProfile1D>;
@@ -70,80 +64,62 @@ namespace Online   {
     double *GetBinSumw2Arr(void){return GetBinSumw2()->GetArray();};
     double gfYmin(){return fYmin;};
     double gfYmax(){return fYmax;};
-    void movetodimbuffer(void *base)
-    {
+    void movetodimbuffer(void *base)    {
       size_t blocksize = GetNcells()*sizeof(double);
-      copy_data(AddPtr(base,0*blocksize),GetEntryArr(),blocksize);
-      copy_data(AddPtr(base,0*blocksize),GetEntryArr(),blocksize);
-      copy_data(AddPtr(base,1*blocksize),GetSumwArr(),blocksize);
-      copy_data(AddPtr(base,2*blocksize),GetSumw2Arr(),blocksize);
-      copy_data(AddPtr(base,3*blocksize),GetBinSumw2Arr(),blocksize);
-      return;
+      copy_data(add_ptr(base, 0*blocksize), GetEntryArr(),    blocksize);
+      copy_data(add_ptr(base, 0*blocksize), GetEntryArr(),    blocksize);
+      copy_data(add_ptr(base, 1*blocksize), GetSumwArr(),     blocksize);
+      copy_data(add_ptr(base, 2*blocksize), GetSumw2Arr(),    blocksize);
+      copy_data(add_ptr(base, 3*blocksize), GetBinSumw2Arr(), blocksize);
     }
-    void movefromdimbuffer(void *base)
-    {
-      int blocksize;
-      blocksize = GetNcells()*sizeof(double);
-      memcpy(GetEntryArr(),AddPtr(base,0*blocksize),blocksize);
-      memcpy(GetSumwArr(),AddPtr(base,1*blocksize),blocksize);
-      memcpy(GetSumw2Arr(),AddPtr(base,2*blocksize),blocksize);
-      memcpy(GetBinSumw2Arr(),AddPtr(base,3*blocksize),blocksize);
-      return;
+    void movefromdimbuffer(const void *base)    {
+      int blocksize = GetNcells()*sizeof(double);
+      memcpy(GetEntryArr(),    add_ptr(base,0*blocksize), blocksize);
+      memcpy(GetSumwArr(),     add_ptr(base,1*blocksize), blocksize);
+      memcpy(GetSumw2Arr(),    add_ptr(base,2*blocksize), blocksize);
+      memcpy(GetBinSumw2Arr(), add_ptr(base,3*blocksize), blocksize);
     }
   };
 
-  class MyTH2D : public TH2D
-  {
+  class MyTH2D : public TH2D  {
   public:
     using TH2D::TH2D;
     friend class MonHist<const ::AIDA::IHistogram2D>;
     friend class HistSerDes;
     double *GetEntryArr(void){return fArray;};
     double *GetSumw2Arr(void){return GetSumw2()->GetArray();};
-    void movetodimbuffer(void *base)
-    {
-      int blocksize;
-      blocksize = GetNcells()*sizeof(double);
-      copy_data(AddPtr(base,0*blocksize),GetEntryArr(),blocksize);
-      copy_data(AddPtr(base,1*blocksize),GetSumw2Arr(),blocksize);
-      return;
+    void movetodimbuffer(void *base)    {
+      int blocksize = GetNcells()*sizeof(double);
+      copy_data(add_ptr(base,0*blocksize),GetEntryArr(),blocksize);
+      copy_data(add_ptr(base,1*blocksize),GetSumw2Arr(),blocksize);
     }
-    void movefromdimbuffer(void *base)
-    {
-      int blocksize;
-      blocksize = GetNcells()*sizeof(double);
-      memcpy(GetEntryArr(),AddPtr(base,0*blocksize),blocksize);
-      memcpy(GetSumw2Arr(),AddPtr(base,1*blocksize),blocksize);
-      return;
+    void movefromdimbuffer(const void *base)    {
+      int blocksize = GetNcells()*sizeof(double);
+      memcpy(GetEntryArr(),add_ptr(base,0*blocksize),blocksize);
+      memcpy(GetSumw2Arr(),add_ptr(base,1*blocksize),blocksize);
     }
   };
-  class MyTH3D : public TH3D
-  {
+
+  class MyTH3D : public TH3D  {
   public:
     using TH3D::TH3D;
     friend class MonHist<const ::AIDA::IHistogram3D>;
     friend class HistSerDes;
     double *GetEntryArr(void){return fArray;};
     double *GetSumw2Arr(void){return GetSumw2()->GetArray();};
-    void movetodimbuffer(void *base)
-    {
-      int blocksize;
-      blocksize = GetNcells()*sizeof(double);
-      copy_data(AddPtr(base,0*blocksize),GetEntryArr(),blocksize);
-      copy_data(AddPtr(base,1*blocksize),GetSumw2Arr(),blocksize);
-      return;
+    void movetodimbuffer(void *base)    {
+      int blocksize = GetNcells()*sizeof(double);
+      copy_data(add_ptr(base,0*blocksize),GetEntryArr(),blocksize);
+      copy_data(add_ptr(base,1*blocksize),GetSumw2Arr(),blocksize);
     }
-    void movefromdimbuffer(void *base)
-    {
-      int blocksize;
-      blocksize = GetNcells()*sizeof(double);
-      memcpy(GetEntryArr(),AddPtr(base,0*blocksize),blocksize);
-      memcpy(GetSumw2Arr(),AddPtr(base,1*blocksize),blocksize);
-      return;
+    void movefromdimbuffer(const void *base)    {
+      int blocksize = GetNcells()*sizeof(double);
+      memcpy(GetEntryArr(),add_ptr(base,0*blocksize),blocksize);
+      memcpy(GetSumw2Arr(),add_ptr(base,1*blocksize),blocksize);
     }
   };
-  class MyTProfile2D : public TProfile2D
-  {
+
+  class MyTProfile2D : public TProfile2D  {
   public:
     using TProfile2D::TProfile2D;
     friend class MonHist<const ::AIDA::IProfile2D>;
@@ -158,34 +134,27 @@ namespace Online   {
     int NBinEntries(void){return fBinEntries.fN;};
     int NSumw2(void){return GetSumw2()->fN;}
     int NBinSumw2(void){return GetBinSumw2()->fN;}
-    void SetfZmin(double d){fZmin =d;return;};
-    void SetfZmax(double d){fZmax =d;return;};
-    void movetodimbuffer(void *base)
-    {
-      int blocksize;
-      blocksize = GetNcells()*sizeof(double);
-      copy_data(AddPtr(base,0*blocksize),GetEntryArr(),blocksize);
-      copy_data(AddPtr(base,1*blocksize),GetSumwArr(),blocksize);
-      copy_data(AddPtr(base,2*blocksize),GetSumw2Arr(),blocksize);
-      copy_data(AddPtr(base,3*blocksize),GetBinSumw2Arr(),blocksize);
-      return;
+    void SetfZmin(double d){fZmin =d;  };
+    void SetfZmax(double d){fZmax =d;  };
+    void movetodimbuffer(void *base)    {
+      int blocksize = GetNcells()*sizeof(double);
+      copy_data(add_ptr(base,0*blocksize),GetEntryArr(),blocksize);
+      copy_data(add_ptr(base,1*blocksize),GetSumwArr(),blocksize);
+      copy_data(add_ptr(base,2*blocksize),GetSumw2Arr(),blocksize);
+      copy_data(add_ptr(base,3*blocksize),GetBinSumw2Arr(),blocksize);
     }
-    void movefromdimbuffer(void *base)
-    {
-      int blocksize;
-      blocksize = GetNcells()*sizeof(double);
-      memcpy(GetEntryArr(),AddPtr(base,0*blocksize),blocksize);
-      memcpy(GetSumwArr(),AddPtr(base,1*blocksize),blocksize);
-      memcpy(GetSumw2Arr(),AddPtr(base,2*blocksize),blocksize);
-      memcpy(GetBinSumw2Arr(),AddPtr(base,3*blocksize),blocksize);
-      return;
+    void movefromdimbuffer(const void *base)    {
+      int blocksize = GetNcells()*sizeof(double);
+      memcpy(GetEntryArr(),add_ptr(base,0*blocksize),blocksize);
+      memcpy(GetSumwArr(),add_ptr(base,1*blocksize),blocksize);
+      memcpy(GetSumw2Arr(),add_ptr(base,2*blocksize),blocksize);
+      memcpy(GetBinSumw2Arr(),add_ptr(base,3*blocksize),blocksize);
     }
   };
-  class MyTProfile3D : public TProfile3D
-  {
+
+  class MyTProfile3D : public TProfile3D  {
   public:
     using TProfile3D::TProfile3D;
-    //  friend class MonHist<const AIDA::IProfile3D>;
     friend class HistSerDes;
     double *GetSumwArr(void){return fArray;};
     double *GetEntryArr(void){return fBinEntries.GetArray();};
@@ -197,43 +166,32 @@ namespace Online   {
     int NBinEntries(void){return fBinEntries.fN;};
     int NSumw2(void){return GetSumw2()->fN;}
     int NBinSumw2(void){return GetBinSumw2()->fN;}
-    void SetfTmin(double d){fTmin =d;return;};
-    void SetfTmax(double d){fTmax =d;return;};
-    void movetodimbuffer(void *base)
-    {
-      int blocksize;
-      blocksize = GetNcells()*sizeof(double);
-      copy_data(AddPtr(base,0*blocksize),GetEntryArr(),blocksize);
-      copy_data(AddPtr(base,1*blocksize),GetSumwArr(),blocksize);
-      copy_data(AddPtr(base,2*blocksize),GetSumw2Arr(),blocksize);
-      copy_data(AddPtr(base,3*blocksize),GetBinSumw2Arr(),blocksize);
-      return;
+    void SetfTmin(double d){fTmin =d;  };
+    void SetfTmax(double d){fTmax =d;  };
+    void movetodimbuffer(void *base)    {
+      int blocksize = GetNcells()*sizeof(double);
+      copy_data(add_ptr(base,0*blocksize),GetEntryArr(),blocksize);
+      copy_data(add_ptr(base,1*blocksize),GetSumwArr(),blocksize);
+      copy_data(add_ptr(base,2*blocksize),GetSumw2Arr(),blocksize);
+      copy_data(add_ptr(base,3*blocksize),GetBinSumw2Arr(),blocksize);
     }
-    void movefromdimbuffer(void *base)
-    {
-      int blocksize;
-      blocksize = GetNcells()*sizeof(double);
-      memcpy(GetEntryArr(),AddPtr(base,0*blocksize),blocksize);
-      memcpy(GetSumwArr(),AddPtr(base,1*blocksize),blocksize);
-      memcpy(GetSumw2Arr(),AddPtr(base,2*blocksize),blocksize);
-      memcpy(GetBinSumw2Arr(),AddPtr(base,3*blocksize),blocksize);
-      return;
+    void movefromdimbuffer(void *base)    {
+      int blocksize = GetNcells()*sizeof(double);
+      memcpy(GetEntryArr(),add_ptr(base,0*blocksize),blocksize);
+      memcpy(GetSumwArr(),add_ptr(base,1*blocksize),blocksize);
+      memcpy(GetSumw2Arr(),add_ptr(base,2*blocksize),blocksize);
+      memcpy(GetBinSumw2Arr(),add_ptr(base,3*blocksize),blocksize);
     }
   };
-  class MyTArrayD : public TArrayD
-  {
+  class MyTArrayD : public TArrayD  {
   public:
     using TArrayD::TArrayD;
-    void Dump(char *nam=0)
-    {
-      if (nam == 0)
-	{
-	  nam = (char*)"TArrayD<noname>";
-	}
+    void Dump(char *nam=0)    {
+      if (nam == 0)	{
+	nam = (char*)"TArrayD<noname>";
+      }
       for (int i=0;i<fN;i++)
-	{
-	  printf("   %s %d %f\n",nam,i,fArray[i]);
-	}
+	printf("   %s %d %f\n",nam,i,fArray[i]);
     }
   };
 }
diff --git a/Online/GauchoBase/Gaucho/SerialHeader.h b/Online/GauchoBase/Gaucho/SerialHeader.h
index d844d146ebb65000fb83084b072991623910584f..06c0f7b07f02751ca3fdadc3380bdc99815eb327 100644
--- a/Online/GauchoBase/Gaucho/SerialHeader.h
+++ b/Online/GauchoBase/Gaucho/SerialHeader.h
@@ -22,92 +22,88 @@
 #include <cstring>
 
 #define SERHEADER_Compress 1<<0
-#define SERHEADER_Version 2
-#define SERIAL_MAGIC 0xfeedbabe
+#define SERHEADER_Version  2
+#define SERIAL_MAGIC       0xfeedbabe
 
-class SerialHeader_V1
-{
-public:
-  unsigned int m_magic;
-  int flags;
-  int version;
-  int comp_version;
-  long ser_tim;
-  long run_number;
-  int buffersize;
-};
-class SerialHeader_V2
-{
-public:
-  unsigned int m_magic;
-  int flags;
-  int version;
-  int comp_version;
-  long ser_tim;
-  long run_number;
-  int buffersize;
-  unsigned int updateInterval;
-  int level;
-};
-class SerialHeader
-{
-public:
-  unsigned int m_magic;
-  int flags;
-  int version;
-  int comp_version;
-  long ser_tim;
-  long run_number;
-  int buffersize;
-  unsigned int updateInterval;
-  int level;
-  SerialHeader() : m_magic(SERIAL_MAGIC),flags(0),version(SERHEADER_Version),comp_version(0),ser_tim(0),run_number(0),buffersize(0),updateInterval(0),level(0){}
-  SerialHeader & operator = (const SerialHeader &t){memcpy(this,&t, t.SizeOf());return *this;}
-  void* endPtr()
-  {
-    void *p;
-    switch(version)
-    {
+namespace Online   {
+
+  class SerialHeader_V1   {
+  public:
+    unsigned int m_magic;
+    int flags;
+    int version;
+    int comp_version;
+    long ser_tim;
+    long run_number;
+    int buffersize;
+  };
+
+  class SerialHeader_V2   {
+  public:
+    unsigned int m_magic;
+    int flags;
+    int version;
+    int comp_version;
+    long ser_tim;
+    long run_number;
+    int buffersize;
+    unsigned int updateInterval;
+    int level;
+  };
+
+  class SerialHeader   {
+  public:
+    unsigned int m_magic;
+    int          flags;
+    int          version;
+    int          comp_version;
+    long         ser_tim;
+    long         run_number;
+    int          buffersize;
+    unsigned int updateInterval;
+    int          level;
+
+    SerialHeader();
+    SerialHeader & operator = (const SerialHeader &copy);
+
+    template <typename RETURN_TYPE=void> RETURN_TYPE* endPtr()  {
+      switch(version)    {
       case 1:
-      {
-        p = (void*)((char*)this+sizeof(SerialHeader_V1));
-        return p;
-      }
+      return (RETURN_TYPE*)((char*)this + sizeof(SerialHeader_V1));
       case 2:
-      {
-        p = (void*)((char*)this+sizeof(SerialHeader_V2));
-        return p;
-      }
+      return (RETURN_TYPE*)((char*)this + sizeof(SerialHeader_V2));
       default:
-      {
-        p =this;
-        p = (void*)((char*)p+sizeof(SerialHeader));
-        return p;
+      return (RETURN_TYPE*)((char*)this + sizeof(SerialHeader));
       }
     }
-  }
-  size_t SizeOf() const
-  {
-    size_t s;
-    switch(version)
-    {
+    size_t SizeOf() const  {
+      switch(version)   {
       case 1:
-      {
-        s = sizeof(SerialHeader_V1);
-        return s;
-      }
+	return sizeof(SerialHeader_V1);
       case 2:
-      {
-        s = sizeof(SerialHeader_V2);
-        return s;
-      }
+	return sizeof(SerialHeader_V2);
       default:
-      {
-        s = sizeof(SerialHeader);
-        return s;
+	return sizeof(SerialHeader);
       }
     }
-  }
-};
+  };
 
+  inline SerialHeader::SerialHeader() 
+    : m_magic(SERIAL_MAGIC),
+    flags(0),
+    version(SERHEADER_Version),
+    comp_version(0),
+    ser_tim(0),
+    run_number(0),
+    buffersize(0),
+    updateInterval(0),
+    level(0)
+      {
+      }
+
+  inline SerialHeader & SerialHeader::operator = (const SerialHeader &copy)  {
+    ::memcpy(this, &copy, copy.SizeOf());
+    return *this;
+  }
+}
 #endif /* SERIALHEADER_H_ */
diff --git a/Online/GauchoBase/Gaucho/Serializer.h b/Online/GauchoBase/Gaucho/Serializer.h
new file mode 100644
index 0000000000000000000000000000000000000000..1361402885a42a630a23be0dad19b9a91c72e73a
--- /dev/null
+++ b/Online/GauchoBase/Gaucho/Serializer.h
@@ -0,0 +1,32 @@
+//==========================================================================
+//  LHCb Online software suite
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see OnlineSys/LICENSE.
+//
+// Author     : B.Jost
+//
+//==========================================================================
+#ifndef ONLINE_GAUCHO_SERIALIZER_H
+#define ONLINE_GAUCHO_SERIALIZER_H
+
+#include <string>
+#include <vector>
+
+/// Online namespace declaration
+namespace Online  {
+
+  class Serializer  {
+  public:
+    virtual ~Serializer() = default;
+    virtual std::pair<size_t,void*> serialize_obj(size_t offset, bool clear=false) = 0;
+    virtual std::pair<size_t,void*> serialize_obj(const std::string& name, size_t offset, bool clear=false) = 0;
+    virtual std::pair<size_t,void*> serialize_obj(const std::vector<std::string> &nams, size_t offset, bool clear=false) = 0;
+    virtual std::pair<size_t,void*> serialize_dir(size_t offset) = 0;
+    virtual std::pair<size_t,const void*> data()   const = 0;
+    virtual void updateExpansions() = 0;
+  };
+}
+#endif   // ONLINE_GAUCHO_SERIALIZER_H
diff --git a/Online/GauchoBase/Gaucho/TaskSaveTimer.h b/Online/GauchoBase/Gaucho/TaskSaveTimer.h
index 4e55e028650bf7b90f2247cfb9556d2b3962e06a..ac02cc2b95ced3a95bcf262841b3fbab5621d0de 100644
--- a/Online/GauchoBase/Gaucho/TaskSaveTimer.h
+++ b/Online/GauchoBase/Gaucho/TaskSaveTimer.h
@@ -24,10 +24,8 @@ namespace Online   {
 
   class TaskSaveTimer : public GenTimer
   {
-    MonSubSys *m_subsys         { nullptr };
+    std::shared_ptr<MonSubSys>        m_subsys;
     std::unique_ptr<unsigned char []> m_buffer;
-    std::unique_ptr<TFile>            m_currFile;
-    MonSys *m_MonSys            { nullptr };
     std::string m_filename      { };
     std::string m_rootdir       { };
     std::string m_partname      { };
@@ -41,18 +39,17 @@ namespace Online   {
   public:
 
   public:
-    TaskSaveTimer(MonSubSys *tis, int period = 900);
-    virtual ~TaskSaveTimer() = default;
+    TaskSaveTimer(std::shared_ptr<MonSubSys> tis, int period = 900);
+    virtual ~TaskSaveTimer();
     void setRootDir(const std::string &p)   { m_rootdir     = p;    }
     void setPartName(const std::string &p)  { m_partname    = p;    }
     void setTaskName(const std::string &p)  { m_taskname    = p;    }
-    void setMonSys(MonSys *p)               { m_MonSys      = p;    }
     void setEOR(bool flg)                   { m_EOR         = flg;  }
     void setService(DimService* svc)        { m_filenamesvc = svc;  }
     void savetoFile(void *buff);
     void makeDirs(int runno);
-    void openFile();
-    void closeFile();
+    std::unique_ptr<TFile> openFile();
+    void closeFile(std::unique_ptr<TFile>&& file);
 
     void timerHandler ( void ) override;
     void stop()   override;
diff --git a/Online/GauchoBase/Gaucho/Utilities.h b/Online/GauchoBase/Gaucho/Utilities.h
index 1f5ddb76624e289b2f0ade546a737638bb65fe55..d4e1049d2c9541db20f49279df8b29332af0fc74 100644
--- a/Online/GauchoBase/Gaucho/Utilities.h
+++ b/Online/GauchoBase/Gaucho/Utilities.h
@@ -26,12 +26,6 @@
 #define AddPtr(ptr,offs) (void*)((char *)ptr +offs)
 
 namespace    {
-  template <typename T=void> inline T* add_ptr(void* ptr, unsigned long offs)   {
-    return reinterpret_cast<T*>(((char*)ptr + offs));
-  }
-  template <typename T=void> inline const T* add_ptr(const void* ptr, unsigned long offs)   {
-    return reinterpret_cast<const T*>(((const char*)ptr + offs));
-  }
 
   template <typename Q, typename T> void locked_execution(Q* q, T func)    {
     typename Q::_Lock lck(q);
diff --git a/Online/GauchoBase/Gaucho/dimhist.h b/Online/GauchoBase/Gaucho/dimhist.h
index c8330ebc30749866a984c52ae2acb66521afe14a..b781638cb784ab9c888ea8068c63424a37bbd176 100644
--- a/Online/GauchoBase/Gaucho/dimhist.h
+++ b/Online/GauchoBase/Gaucho/dimhist.h
@@ -13,34 +13,30 @@
 #define DIMHIST_DEF
 
 #include <cstddef>
+#include <cstring>
 #include <utility>
 #include <vector>
 
-#define DIMTYPE DimUpdatedInfo
 #define FLAGS_XLABELS 1<<0
 #define FLAGS_YLABELS 1<<1
 
+#if defined(__clang__) || defined(__CLING__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wclass-memaccess"
+#elif defined(__GNUC__) && __GNUC__ >= 9
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
+
 /// Online namespace declaration
 namespace Online  {
 
-  template <typename T> class MonHist;
-  struct BinNAxis;
-
-  struct GaudiProfileBin   {
-    unsigned long nent;
-    double sumw;
-    double sumw2;
-  };
-
-  struct DimAxis   {
-  public:
-    int    nbin;
-    double min;
-    double max;
-    int    lablen;
-    int    laboff;
-    void fetch(const BinNAxis& axis);
-  };
+  template <typename T=void> inline T* add_ptr(void* ptr, unsigned long offs)   {
+    return reinterpret_cast<T*>(((char*)ptr + offs));
+  }
+  template <typename T=void> inline const T* add_ptr(const void* ptr, unsigned long offs)   {
+    return reinterpret_cast<const T*>(((const char*)ptr + offs));
+  }
 
   class DimBuffBase   {
   public:
@@ -54,6 +50,52 @@ namespace Online  {
     int titlen        { 0 };
     int dataoff       { 0 };
     int addoffset     { 0 };
+    template < typename TYPE > TYPE* as()   const    {
+      return (TYPE*)this;
+    }
+    /// Only call this once the structure is filled!
+    void clear()   {
+      ::memset(add_ptr(this, this->dataoff), 0, this->reclen - this->dataoff);
+    }
+    const char* name()   const   {
+      return add_ptr<char>(this, this->nameoff);
+    }
+  };
+}
+
+#if defined(__clang__) || defined(__CLING__)
+#pragma clang diagnostic pop
+#elif defined(__GNUC__) && __GNUC__ >= 5
+#pragma GCC diagnostic pop
+#endif
+
+/// Online namespace declaration
+namespace Online  {
+
+  template <typename T> class MonHist;
+  class BinNAxis;
+
+  class GaudiProfileBin   {
+  public:
+    unsigned long nent;
+    double sumw;
+    double sumw2;
+  };
+
+  class DimAxis   {
+  public:
+    int    nbin       {   0 };
+    double min        { 0.0 };
+    double max        { 0.0 };
+    int    lablen     {   0 };
+    int    laboff     {   0 };
+    void fetch(const BinNAxis& axis);
+  };
+
+  class DimDirEnt   {
+  public:
+    int  type         { 0 };
+    char name[32];
   };
 
   class DimStatBuff : public DimBuffBase  {
diff --git a/Online/GauchoBase/Gaucho/mem_buff.h b/Online/GauchoBase/Gaucho/mem_buff.h
new file mode 100644
index 0000000000000000000000000000000000000000..55763bdbde479cf10b8dfdf509f459d78a5ffa8e
--- /dev/null
+++ b/Online/GauchoBase/Gaucho/mem_buff.h
@@ -0,0 +1,150 @@
+
+#ifndef ONLINEBASE_CPP_MEM_BUF_H
+#define ONLINEBASE_CPP_MEM_BUF_H
+
+
+#include <memory>
+#include <cstring>
+
+class mem_buff  {
+ private:
+  std::unique_ptr<unsigned char[]> data  {   };
+  unsigned char* pointer                 { nullptr };
+  size_t size                            { 0 };
+ public:
+  mem_buff() = default;
+  mem_buff(size_t len);
+  mem_buff(const void* pointer, size_t len);
+  ~mem_buff() = default;
+  unsigned char*       begin()        {   return this->data.get();               }
+  const unsigned char* begin() const  {   return this->data.get();               }
+  unsigned char*       end()          {   return this->data.get() + this->size;  }
+  const unsigned char* end() const    {   return this->data.get() + this->size;  }
+  unsigned char* ptr()                {   return this->pointer;                  }
+  const unsigned char* ptr() const    {   return this->pointer;                  }
+  size_t length()  const              {   return this->size;                     }
+  size_t used()    const              {   return this->pointer - this->begin();  }
+  unsigned char* copy(const void* pointer, size_t len);
+  unsigned char* copy(const mem_buff& copy);
+  unsigned char* append(const void* pointer, size_t len);
+  unsigned char* append(const mem_buff& buffer);
+  
+  unsigned char* allocate(size_t len, bool reset=false);
+  unsigned char* reallocate(size_t len);
+  void reset(unsigned char val = 0);
+  void set_cursor(size_t offset);
+  template <typename T = unsigned char> T* as();
+  template <typename T = unsigned char> const T* as()  const;
+  template <typename T = unsigned char> T* begin();
+  template <typename T = unsigned char> const T* begin()  const;
+  template <typename T = unsigned char> T* at(size_t offset=0);
+  template <typename T = unsigned char> const T* at(size_t offset=0)  const;
+  //template <typename T = unsigned char> T* advance(size_t offset);
+};
+
+
+inline mem_buff::mem_buff(size_t len) : size(len)  {
+  this->data.reset(pointer = new unsigned char[this->size]);
+}
+
+inline mem_buff::mem_buff(const void* source, size_t len) : size(len)  {
+  this->data.reset(this->pointer = new unsigned char[this->size]);
+  ::memcpy(this->pointer, source, this->size);
+}
+
+inline unsigned char* mem_buff::allocate(size_t len, bool reset)    {
+  if ( len > this->size )   {
+    this->data.reset(this->pointer = new unsigned char[this->size = len]);
+  }
+  if ( reset )   {
+    ::memset(this->data.get(), 0, this->size);
+  }
+  return this->pointer = this->data.get();
+}
+
+inline unsigned char* mem_buff::reallocate(size_t len)    {
+  if ( len > this->size )   {
+    size_t old_len = this->size;
+    size_t offset  = this->pointer - this->data.get();
+    std::unique_ptr<unsigned char[]> old(this->data.release());
+    this->data.reset(this->pointer = new unsigned char[this->size = len]);
+    if ( old_len )   {
+      ::memcpy(this->pointer, old.get(), old_len);
+      this->pointer += offset;
+    }
+  }
+  // Advance pointer to old position or not?
+  return this->pointer;
+}
+
+inline void mem_buff::reset(unsigned char val)   {
+  if ( this->data.get() )   {
+    ::memset(this->data.get(), val, this->size);
+    this->pointer = this->data.get();
+  }
+}
+
+inline unsigned char* mem_buff::copy(const void* source, size_t len)   {
+  if ( !this->data.get() || len > this->size )   {
+    this->allocate(len);
+  }
+  this->pointer = this->data.get();
+  ::memcpy(this->pointer, source, len);
+  this->pointer += len;
+  return this->pointer;
+}
+
+inline unsigned char* mem_buff::copy(const mem_buff& copy)   {
+  return this->copy(copy.data.get(), copy.used());
+}
+
+inline unsigned char* mem_buff::append(const void* source, size_t len)   {
+  if ( !this->data.get() )
+    this->allocate(len);
+  else if ( this->pointer + len > this->data.get() + this->size )
+    this->reallocate(1.5*(this->size + len));
+  ::memcpy(this->pointer, source, len);
+  this->pointer += len;
+  return this->pointer;
+}
+
+inline unsigned char* mem_buff::append(const mem_buff& buff)   {
+  return this->append(buff.data.get(), buff.used());
+}
+
+inline void mem_buff::set_cursor(size_t offset)   {
+  this->pointer = this->data.get() + offset;
+}
+
+#if 0
+template <typename T> inline T* mem_buff::advance(size_t offset)   {
+  auto* p = (T*)this->pointer;
+  this->pointer += offset;
+  return p;
+}
+#endif
+
+template <typename T> inline T* mem_buff::as()   {
+  return (T*)this->data.get();
+}
+
+template <typename T> inline const T* mem_buff::as()  const {
+  return (const T*)this->data.get();
+}
+
+template <typename T> inline T* mem_buff::begin()   {
+  return (T*)this->data.get();
+}
+
+template <typename T> inline const T* mem_buff::begin()  const {
+  return (const T*)this->data.get();
+}
+
+template <typename T> inline T* mem_buff::at(size_t offset)   {
+  return (T*)(this->data.get() + offset);
+}
+
+template <typename T> inline const T* mem_buff::at(size_t offset)  const {
+  return (const T*)(this->data.get() + offset);
+}
+#endif // ONLINEBASE_CPP_MEM_BUF_H
diff --git a/Online/GauchoBase/src/CounterSubSys.cpp b/Online/GauchoBase/src/CounterSubSys.cpp
index baf4143b128b3faaa435161ec0b9a10dc1012a4e..8331f79eb424cb5584b9fc9adc65b3495f85aa7e 100644
--- a/Online/GauchoBase/src/CounterSubSys.cpp
+++ b/Online/GauchoBase/src/CounterSubSys.cpp
@@ -10,70 +10,38 @@
 //
 //==========================================================================
 #include <Gaucho/CounterSubSys.h>
-#include <Gaucho/MonSys.h>
-#include <Gaucho/MonCounter.h>
-#include <Gaucho/RateMgr.h>
 #include <Gaucho/MonitorClass.h>
+#include <Gaucho/RateMgr.h>
+#include <RTL/rtl.h>
 
-using namespace std;
-using namespace Online;
-
-CounterSubSys::CounterSubSys(SubSysParams &p):
+Online::CounterSubSys::CounterSubSys(SubSysParams &p):
   MonSubSys(p), ratePrefix(p.ratePrefix),
   expandInfix(p.expandInfix), updatePeriod(p.updatePeriod), expandnames(p.expandnames)
 {
   this->dontclear = false;
 }
 
-CounterSubSys::~CounterSubSys()  {
-  if (this->expandnames && this->type == MONSUBSYS_Counter)    {
-    locked_execution(this, [this]() {
-	for (auto& i : this->objMap )
-	  i.second->delete_OutputService();
-      });
-  }
-}
-
-void CounterSubSys::add_counter(MonBase* h,MonRateBase* r)   {
-  auto i = this->classMgr.getMap().begin();
-  for (i=this->classMgr.getMap().begin();i!=this->classMgr.getMap().end();i++)  {
-    if (i->second->matchName(h->name))    {
-      break;
-    }
-  }
-  if (i == this->classMgr.getMap().end())  {
-    i = this->classMgr.getMap().find(MonitorClass::DefaultClassName);
-  }
-  i->second->add(h);
-  if (r != 0)  {
-    i->second->add(r);
-    i->second->rateManager->addRate(r->name,*r);
+void Online::CounterSubSys::add_counter(std::unique_ptr<MonBase>&& h, std::unique_ptr<MonRateBase>&& r)   {
+  auto cls = this->classMgr.getClass(h->name);
+  cls->add(std::move(h));
+  if ( r )  {
+    cls->add(std::move(r));
   }
-  i->second->setType(type);
+  this->numObjs++;
 }
 
-void CounterSubSys::remove(const string &nam)   {
-  string ratenam = this->ratePrefix+nam;
-  this->classMgr.unregisterEntry(nam);
-  this->classMgr.unregisterEntry(ratenam);
-  auto i = this->classMgr.getMap().begin();
-  for (i=this->classMgr.getMap().begin();i!=this->classMgr.getMap().end();i++)  {
-    if (i->second->matchName(nam))   {
-      break;
-    }
+size_t Online::CounterSubSys::remove(const std::string &nam)   {
+  auto ratename = this->ratePrefix+nam;
+  auto cls = this->classMgr.getClass(nam);
+  cls->remove(ratename);
+  auto ret = cls->remove(nam);
+  if ( ret )   {
+    this->numObjs--;
+    return 1;
   }
-  if (i == this->classMgr.getMap().end())  {
-    i = this->classMgr.getMap().find(MonitorClass::DefaultClassName);
-  }
-  unique_ptr<MonBase> e(i->second->remove(nam));
-  this->objMap.erase(nam);
-  this->entrySet.erase(nam);
-
-  e.reset(i->second->remove(ratenam));
-  this->objMap.erase(ratenam);
-  i->second->rateManager->removeRate(ratenam);
+  return 0;
 }
 
-void CounterSubSys::setup(const string& n, bool )   {
-  this->classMgr.setup(name=n, expandnames, expandInfix, pname=RTL::processName());
+void Online::CounterSubSys::setup(const std::string& n, bool )   {
+  this->classMgr.setup(name=n, expandnames, expandInfix, RTL::processName());
 }
diff --git a/Online/GauchoBase/src/GenTimer.cpp b/Online/GauchoBase/src/GenTimer.cpp
index f264cf963246ac9a54669e447dfcd2bdff9109f4..da6d03ba699562256d692602365311e8dfb83d92 100644
--- a/Online/GauchoBase/src/GenTimer.cpp
+++ b/Online/GauchoBase/src/GenTimer.cpp
@@ -28,34 +28,22 @@
 
 using namespace Online;
 
-namespace
-{
+namespace    {
   int ThreadRoutine_C(void* arg)    {
     GenTimer *t = (GenTimer*)arg;
     t->ThreadRoutine();
-    t->m_threadpid =0;
+    t->m_threadpid = 0;
     return 1;
   }
 }
 
-GenTimer::GenTimer(void *arg, int period, int typ)
+GenTimer::GenTimer(void *arg, int periodicity, int typ)
 {
-  m_arg          = arg;
-  m_period       = period;
-  m_type         = typ;
-  m_dueTime      = 0;
-  m_periodic     = (typ & TIMER_TYPE_PERIODIC) != 0;
-  m_synched      = (typ & TIMER_MODIFYER_SYNCHRONIZED) != 0;
-  m_thread       = 0;
-  m_extlastdelta = 0;
-  m_ForceExit    = false;
-  m_dontdimlock = true;
-  m_threadpid = 0;
-  m_lastfire = 0;
-  m_lastdelta = 0;
-  m_ThreadBalance = 0;
-  m_stopSeen = false;
-  m_timeout = 0;
+  this->arg          = arg;
+  this->period       = periodicity;
+  this->type         = typ;
+  this->periodic     = (typ & TIMER_TYPE_PERIODIC) != 0;
+  this->synched      = (typ & TIMER_MODIFYER_SYNCHRONIZED) != 0;
 }
 
 GenTimer::~GenTimer( )
@@ -67,21 +55,21 @@ void GenTimer::start()    {
   if ( m_thread == 0 )  {
     m_ForceExit = false;
     this->m_stopSeen = false;
-    m_thread = new std::thread(ThreadRoutine_C,this);
+    m_thread = std::make_unique<std::thread>(ThreadRoutine_C,this);
     m_ThreadBalance++;
   }
   else  {
-    if (!m_periodic)    {
+    if ( !this->periodic )    {
       stop();
       m_ForceExit = false;
-      m_thread = new std::thread(ThreadRoutine_C,this);
+      m_thread = std::make_unique<std::thread>(ThreadRoutine_C,this);
       m_ThreadBalance++;
     }
   }
 }
 
-void GenTimer::startPeriodic(int period)    {
-  m_period = period*1000;
+void GenTimer::startPeriodic(int periodicity)    {
+  this->period = periodicity*1000;
   this->start();
 }
 
@@ -98,7 +86,7 @@ void GenTimer::stop()   {
       ncnt++;
     }
     m_thread->detach();
-    deletePtr(m_thread);
+    m_thread.reset();
     m_ThreadBalance--;
   }
   if (!this->m_dontdimlock) dim_unlock();
@@ -167,22 +155,19 @@ unsigned long GenTimer::getDeltaTime(int incr)
   timstamp *= onesec_nano;
   timstamp += tv.tv_usec*1000;
   m_lastfire = timstamp;
-  if (m_synched)
-  {
-    newtim  = (timstamp/(m_period*onesec_mili));
-    newtim *=(onesec_mili*m_period);
-    newtim += (((unsigned long)incr+m_period)*onesec_mili);
+  if (this->synched)  {
+    newtim  = (timstamp/(this->period*onesec_mili));
+    newtim *=(onesec_mili*this->period);
+    newtim += (((unsigned long)incr+this->period)*onesec_mili);
   }
-  else
-  {
-    newtim = timstamp+(((unsigned long)incr+m_period)*onesec_mili);
+  else  {
+    newtim = timstamp+(((unsigned long)incr+this->period)*onesec_mili);
   }
   m_dueTime = newtim;
   unsigned long dtim = (newtim-timstamp);
-  if (dtim < 20000000)
-  {
-    dtim += m_period*onesec_mili;
-    m_dueTime += m_period*onesec_mili;
+  if (dtim < 20000000)  {
+    dtim += this->period*onesec_mili;
+    m_dueTime += this->period*onesec_mili;
   }
   return dtim;
 #endif
@@ -208,17 +193,6 @@ int GenTimer::NanoSleep(struct timespec *req, struct timespec *)
     {
       status = nanosleep(&req1,&req1);
       if (m_ForceExit) return -1;
-//      if (status == -1)
-//      {
-//        if (errno == EINTR)
-//        {
-//          continue;
-//        }
-//      }
-//      else
-//      {
-//        continue;
-//      }
     }
   }
   if (resttime == 0) return 0;
@@ -237,8 +211,7 @@ int GenTimer::NanoSleep(struct timespec *req, struct timespec *)
 #define gettid() ((int)syscall(SYS_gettid))
 #include <sys/time.h>
 #include <sys/resource.h>
-void *GenTimer::ThreadRoutine()
-{
+void *GenTimer::ThreadRoutine()    {
   unsigned long delta;
   struct timespec req;
   int status;
@@ -293,8 +266,7 @@ void *GenTimer::ThreadRoutine()
       m_stopSeen = true;
       return 0;
     }
-    if (!m_periodic)
-    {
+    if (!this->periodic)    {
       break;
     }
   }
diff --git a/Online/GauchoBase/src/HistSerializers.inl.h b/Online/GauchoBase/src/HistSerializers.inl.h
deleted file mode 100644
index a1f08bfb27a0407644187ed5e4da5c75f10193d1..0000000000000000000000000000000000000000
--- a/Online/GauchoBase/src/HistSerializers.inl.h
+++ /dev/null
@@ -1,12 +0,0 @@
-//==========================================================================
-//  LHCb Online software suite
-//--------------------------------------------------------------------------
-// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
-// All rights reserved.
-//
-// For the licensing terms see OnlineSys/LICENSE.
-//
-// Author     : B.Jost
-//
-//==========================================================================
-
diff --git a/Online/GauchoBase/src/HistSetups.inl.h b/Online/GauchoBase/src/HistSetups.inl.h
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/Online/GauchoBase/src/HistSubSys.cpp b/Online/GauchoBase/src/HistSubSys.cpp
index 4f8a46df4691b05eb4a0b7d7516759fbd6769402..0e0cee3d133d4191c068a9e3c4bd0912ee4627df 100644
--- a/Online/GauchoBase/src/HistSubSys.cpp
+++ b/Online/GauchoBase/src/HistSubSys.cpp
@@ -9,9 +9,11 @@
 // Author     : B.Jost
 //
 //==========================================================================
-#include "Gaucho/MonitorClass.h"
-#include "Gaucho/HistSubSys.h"
-#include "Gaucho/MonSys.h"
+#include <Gaucho/MonitorClass.h>
+#include <Gaucho/HistSubSys.h>
+#include <Gaucho/MonTimer.h>
+#include <Gaucho/MonSys.h>
+#include <RTL/rtl.h>
 
 #include <climits>
 
@@ -19,48 +21,34 @@ using namespace Online;
 
 HistSubSys::HistSubSys(SubSysParams &p) : MonSubSys(p)  {
   this->dontclear    = false; // p.dontclear;
-  this->type         = p.type;
   this->updatePeriod = p.updatePeriod;
 }
 
-HistSubSys::~HistSubSys()  {
-}
-
-void HistSubSys::i_addEntry(MonBase *h)   {
+void HistSubSys::i_addEntry(std::unique_ptr<MonBase>&& h)   {
   size_t len = h->xmitbuffersize();
   if ( len + xmitSize < INT_MAX/4 )    {
+    auto cls = this->classMgr.getClass(h->name);
     this->xmitSize += len;
-    this->objMap.emplace(h->name,h);
     this->numObjs++;
-    this->add(h);
-    this->classMgr.registerEntry(h);
+    cls->add(std::move(h));
     return;
   }
   ::printf("WARNING [Exceeded xmit buffer] Drop histogram: %s\n", h->name.c_str());
-  delete h;
 }
 
-void HistSubSys::remove(const std::string &nam)   {
-  auto& m = this->classMgr.getMap();
-  this->classMgr.unregisterEntry(nam);
-  auto i = m.begin();
-  for ( ; i != m.end(); i++ )  {
-    if (i->second->matchName(nam))
-      break;
-  }
-  if ( i == m.end() )   {
-    i = m.find("**Default**");
-  }
-  std::unique_ptr<MonBase> e(i->second->remove(nam));
+size_t HistSubSys::remove(const std::string &nam)   {
+  auto cls = this->classMgr.getClass(nam);
+  std::unique_ptr<MonBase> e(cls->remove(nam));
   if ( e )   {
     size_t len = e->xmitbuffersize();
     this->xmitSize -= len;
+    return 1;
   }
+  return 0;
 }
 
 void HistSubSys::setup(const std::string& n, bool )   {
-  this->classMgr.setup(this->name=n, this->pname=RTL::processName());
-  MonSys::instance().add(this);
+  this->classMgr.setup(this->name=n, false, "", RTL::processName());
 }
 
 void HistSubSys::setExtLastDelta(unsigned long deltaT)   {
diff --git a/Online/GauchoBase/src/MonClassMgr.cpp b/Online/GauchoBase/src/MonClassMgr.cpp
index 5b4d418a5b0525e5d766336e68e6342354ac8506..13ad9da123fb84b4a56f583cdea8afa8c2d0b762 100644
--- a/Online/GauchoBase/src/MonClassMgr.cpp
+++ b/Online/GauchoBase/src/MonClassMgr.cpp
@@ -9,138 +9,101 @@
 // Author     : B.Jost
 //
 //==========================================================================
-/*
- * MonClassMgr.cpp
- *
- *  Created on: Jun 5, 2019
- *      Author: beat
- */
-
-#include "Gaucho/MonClassMgr.h"
-#include "Gaucho/MonitorClass.h"
-#include "Gaucho/MonSubSysTypes.h"
-#include "Gaucho/RateMgr.h"
-
-#include <list>
-#include <string>
+#include <Gaucho/MonClassMgr.h>
+#include <Gaucho/ObjSerializer.h>
+#include <Gaucho/MonitorClass.h>
+#include <Gaucho/MonSubSys.h>
+#include <Gaucho/MonBase.h>
+#include <Gaucho/RateMgr.h>
+#include <Gaucho/ObjRPC.h>
 
 using namespace std;
 using namespace Online;
 
-MonClassMgr::MonClassMgr(SubSysParams&p)
-{
-  m_type = p.type;
-  this->runAware = p.runAware;
-  m_DefaultClass = 0;
-  m_RPCser=0;
-  m_rpc = 0;
-}
-MonClassMgr::~MonClassMgr()
-{
-  for (auto i=this->m_ClassMap.begin();i!=m_ClassMap.end();i++)
-  {
-    deletePtr(i->second);
-  }
-  m_ClassMap.clear();
-  deletePtr(m_rpc);
-  deletePtr(m_RPCser);
-}
-void MonClassMgr::setDefault(SubSysParams &p)
-{
-  string blk;
-  blk.clear();
-  blk = "thisorthat";
+MonClassMgr::MonClassMgr(const SubSysParams& p)  {
+  string blk = "thisorthat";
   list<string>  l({blk});
   string nam = MonitorClass::DefaultClassName;
 
-  m_DefaultClass = new MonitorClass(nam,p.updatePeriod,l);
-  m_DefaultClass->runAware = p.runAware;
-  m_ClassMap[nam] = m_DefaultClass;
-  if (m_type == MONSUBSYS_Counter)
-  {
-    m_DefaultClass->addRateMgr(new RateMgr("Rates",0));
-  }
+  this->type = p.type;
+  this->runAware = p.runAware;
+  this->defaultClass = std::make_shared<MonitorClass>(nam, p.updatePeriod,l);
+  this->defaultClass->runAware = p.runAware;
+  this->defaultClass->configure(p.type);
+  this->classMap[nam] = this->defaultClass;
 }
 
-void MonClassMgr::registerEntry(MonBase *m)   {
-  m_ObjMap[m->name] = m;
+MonClassMgr::~MonClassMgr()   {
+  this->classMap.clear();
 }
 
-void MonClassMgr::unregisterEntry(const string &nam)   {
-  auto i = m_ObjMap.find(nam);
-  if (i != m_ObjMap.end())  {
-    m_ObjMap.erase(nam);
-  }
-  if (m_ObjMap.size() == 0)    {
-    deletePtr(m_rpc);
-    deletePtr(m_RPCser);
+std::shared_ptr<MonitorClass> MonClassMgr::getClass(const std::string& nam)   {
+  for ( auto& i : this->classMap )   {
+    if ( i.second->matchName(nam) )
+      return i.second;
   }
+  return this->defaultClass;
 }
 
-void MonClassMgr::unregisterAll() {
-  m_ObjMap.clear();
-  if (m_ObjMap.size() == 0)  {
-    deletePtr(m_rpc);
-    deletePtr(m_RPCser);
-  }
+size_t MonClassMgr::clear()   {
+  size_t removed = 0;
+  for ( auto& i : this->classMap )
+    removed += i.second->clear();
+  return removed;
+}
+
+size_t MonClassMgr::removeAll(const std::string& owner_name)  {
+  size_t removed = 0;
+  for ( auto& i : this->classMap )
+    removed += i.second->clearAll(owner_name);
+  return removed;
 }
 
-void MonClassMgr::add(MonitorClass *cl )  {
-  auto i = m_ClassMap.find(cl->ID);
-  if ( i == m_ClassMap.end() )  {
-    m_ClassMap[cl->ID] = cl;
+void MonClassMgr::add(std::shared_ptr<MonitorClass>&& cl )  {
+  auto i = this->classMap.find(cl->ID);
+  if ( i == this->classMap.end() )  {
+    this->classMap[cl->ID] = cl;
     cl->runAware = this->runAware;
   }
 }
 
 void MonClassMgr::setRunNo(int runno)  {
-  for (auto& i : m_ClassMap)
+  for (auto& i : this->classMap)
     i.second->setRunNo(runno);
 }
 
 void MonClassMgr::EORUpdate(int runo)   {
   setRunNo(runo);
-  for (auto& i : m_ClassMap)
+  for (auto& i : this->classMap)
     i.second->EORUpdate(runo);
 }
 
 void MonClassMgr::update()   {
-  for (auto& i : m_ClassMap)
+  for (auto& i : this->classMap)
     i.second->update();
 }
 
 void MonClassMgr::update(unsigned long ref)  {
-  for (auto& i : m_ClassMap)
+  for (auto& i : this->classMap)
     i.second->update(ref);
 }
 
 void MonClassMgr::start()   {
-  for (auto& i : m_ClassMap)
+  for (auto& i : this->classMap)
     i.second->start();
 }
 
 void MonClassMgr::stop()  {
-  for (auto& i : m_ClassMap)
+  for (auto& i : this->classMap)
     i.second->stop();
 }
 
 void MonClassMgr::setup(const std::string& n, bool expandnames, const std::string &einfix, const string &pname)  {
-  string nam;
-  if (m_RPCser == 0)  {
-    m_RPCser = new ObjSerializer(&m_ObjMap, expandnames);
+  string name = (this->type == MONSUBSYS_Counter) ? "Counter" : "Histos";
+  string nam  = "MON_" + pname + "/" + name + "/HistCommand";
+  if ( !this->rpc )   {
+    this->rpc = make_unique<ObjRPC>(make_unique<ObjSerializer>(this, expandnames), nam.c_str(), "I:1;C", "C");
   }
-  string m_name = "Histos";
-  if (m_type == MONSUBSYS_Counter)  {
-    m_name = "Counter";
-  }
-  nam = std::string("MON_") + pname + "/" + m_name + "/HistCommand";
-  if (m_rpc == 0)
-    m_rpc = new ObjRPC(m_RPCser, (char*) (nam ).c_str(), (char*) "I:1;C",
-        (char*) "C");
-  for (auto i=m_ClassMap.begin();i!=m_ClassMap.end();i++)
-    i->second->setup(n,expandnames,einfix);
-}
-
-void MonClassMgr::setup(const string& n, const string &pname) {
-  setup(n, false, "", pname);
+  for ( auto& i : this->classMap )
+    i.second->setup(n, expandnames, einfix);
 }
diff --git a/Online/GauchoBase/src/MonHist.cpp b/Online/GauchoBase/src/MonHist.cpp
index 3187a8d7205827e8266da3c618838c1316d6a00e..2c1414f21a8dbe538237a2a6bb8d710fed304c7d 100644
--- a/Online/GauchoBase/src/MonHist.cpp
+++ b/Online/GauchoBase/src/MonHist.cpp
@@ -11,8 +11,6 @@
 //==========================================================================
 #include <Gaucho/MonHist.h>
 #include <Gaucho/RootHists.h>
-//#include <GaudiUtils/Aida2ROOT.h>
-#include <Gaucho/Utilities.h>
 #include <Gaucho/HistSerDes.h>
 
 #include <AIDA/IHistogram1D.h>
@@ -252,7 +250,7 @@ template <typename T> void MonHist<T>::setup()   {
   }
 }
 
-template <typename T> int MonHist<T>::Serialize(void*& ptr)    {
+template <typename T> int MonHist<T>::serialize(void* ptr)    {
   DimHistbuff1 *b = (DimHistbuff1*) ptr;
   b->setup_buffer(*this);
   b->fetch_labels(this->axes);
@@ -302,10 +300,9 @@ void HistSerDes::SetBinLabels(TAxis *ax, const char *labs)   {
 void HistSerDes::cpyBinLabels(char *dst, const BinNAxis& axis)    {
   const auto& src = axis.labels;
   if ( src.size() > 0 )   {
-    int leni;
     for (size_t i = 0; i < src.size()-1; i++)    {
-      leni = strlen(src[i].c_str());
-      strcpy(dst, src[i].c_str());
+      int leni = src[i].length();
+      strncpy(dst, src[i].c_str(), leni);
       dst[leni] = 0;
       dst += leni + 1;
     }
@@ -335,7 +332,7 @@ void *HistSerDes::de_serialize(const void *ptr, const char *nam)  {
     }
     MyTH1D *h = new MyTH1D(nam, titopt.c_str(), b->x.nbin, b->x.min, b->x.max);
     h->SetEntries(b->nentries);
-    h->movefromdimbuffer(AddPtr(b, b->dataoff));
+    h->movefromdimbuffer(add_ptr(b, b->dataoff));
     if (b->x.lablen > 0)
       HistSerDes::SetBinLabels(&h->fXaxis, add_ptr<char>(b, b->x.laboff));
 
@@ -355,7 +352,7 @@ void *HistSerDes::de_serialize(const void *ptr, const char *nam)  {
 			    b->x.nbin, b->x.min, b->x.max,
 			    b->y.nbin, b->y.min, b->y.max);
     h->SetEntries(b->nentries);
-    h->movefromdimbuffer(AddPtr(b, b->dataoff));
+    h->movefromdimbuffer(add_ptr(b, b->dataoff));
     if (b->x.lablen > 0)
       HistSerDes::SetBinLabels(&h->fXaxis, add_ptr<char>(b, b->x.laboff));
 
@@ -379,7 +376,7 @@ void *HistSerDes::de_serialize(const void *ptr, const char *nam)  {
 			   b->y.nbin, b->y.min, b->y.max,
 			   b->z.nbin, b->z.min, b->z.max);
     h->SetEntries(b->nentries);
-    h->movefromdimbuffer(AddPtr(b, b->dataoff));
+    h->movefromdimbuffer(add_ptr(b, b->dataoff));
     if (b->x.lablen > 0)
       HistSerDes::SetBinLabels(&h->fXaxis, add_ptr<char>(b, b->x.laboff));
 
@@ -405,12 +402,12 @@ void *HistSerDes::de_serialize(const void *ptr, const char *nam)  {
     }
     MyTProfile *h = new MyTProfile(nam, titopt.c_str(),b->x.nbin, b->x.min, b->x.max,bopt.c_str());
     if (b->type != H_GAUDIPR1)    {
-      h->movefromdimbuffer(AddPtr(b, b->dataoff));
+      h->movefromdimbuffer(add_ptr(b, b->dataoff));
     }
     else     {
       h->Sumw2(false);
       size_t nbin = b->x.nbin+2;
-      GaudiProfileBin *sers = (GaudiProfileBin*)AddPtr(b,b->dataoff);
+      const GaudiProfileBin *sers = add_ptr<GaudiProfileBin>(b,b->dataoff);
       for ( size_t i = 0; i < nbin; i++ )     {
 	h->GetEntryArr()[i] = double(sers[i].nent);
 	h->GetSumwArr()[i]  = sers[i].sumw;
@@ -442,12 +439,12 @@ void *HistSerDes::de_serialize(const void *ptr, const char *nam)  {
 						     b->x.nbin, b->x.min, b->x.max,
 						     b->y.nbin, b->y.min, b->y.max, bopt.c_str());
     if (b->type != H_GAUDIPR2)   {
-      h->movefromdimbuffer(AddPtr(b, b->dataoff));
+      h->movefromdimbuffer(add_ptr(b, b->dataoff));
     }
     else     {
       size_t nbin = (b->x.nbin+2)*(b->y.nbin+2);
       for (size_t i=0;i<nbin;i++)      {
-	GaudiProfileBin *sers = (GaudiProfileBin*)AddPtr(b,b->dataoff);
+	const GaudiProfileBin *sers = add_ptr<GaudiProfileBin>(b,b->dataoff);
 	h->GetEntryArr()[i] = double(sers[i].nent);
 	h->GetSumwArr()[i] = sers[i].sumw;
 	h->GetSumw2Arr()[i] = sers[i].sumw2;
@@ -482,7 +479,7 @@ void *HistSerDes::de_serialize(const void *ptr, const char *nam)  {
     else   {
       size_t nbin = (b->x.nbin+2)*(b->y.nbin+2);
       for (size_t i=0;i<nbin;i++)     {
-	GaudiProfileBin *sers = add_ptr<GaudiProfileBin>(b,b->dataoff);
+	const GaudiProfileBin *sers = add_ptr<GaudiProfileBin>(b,b->dataoff);
 	h->GetEntryArr()[i] = double(sers[i].nent);
 	h->GetSumwArr()[i]  = sers[i].sumw;
 	h->GetSumw2Arr()[i] = sers[i].sumw2;
diff --git a/Online/GauchoBase/src/MonInfo.cpp b/Online/GauchoBase/src/MonInfo.cpp
index 69a4c2c0f3ad8a8c56feacc544a12fe96ebc9d56..b5bf39be3ece4d20ea9d3e6124f4e09a17c63492 100644
--- a/Online/GauchoBase/src/MonInfo.cpp
+++ b/Online/GauchoBase/src/MonInfo.cpp
@@ -10,55 +10,40 @@
 //
 //==========================================================================
 #include <Gaucho/MonInfo.h>
-#include <cstdio>
-#include <memory>
-
-static int empty =-1;
+#include <Gaucho/mem_buff.h>
 
 using namespace Online;
 
-static bool ShutdowninProgress = false;
-
-void MonInfo::setShutdownInProgress(bool value)   {
-  ShutdowninProgress = value;
+namespace  {
+  static int s_empty =-1;
+  static bool s_shutdowninProgress = false;
 }
 
-MonInfo::MonInfo(const std::string& target, int period=0)
-  : DIMTYPE(target.c_str(), period, &empty,4)
-{
-  targetService = target;
-  AdderFn = 0;
-  adderobj = 0;
+void MonInfo::setShutdownInProgress(bool value)   {
+  s_shutdowninProgress = value;
 }
 
-MonInfo::MonInfo(const std::string& target, void addfn(void*, void*, int, MonInfo *), void *addobj)
-  : DIMTYPE(target.c_str(), &empty,4)
+MonInfo::MonInfo(const std::string& target, MonInfoHandler* hdlr)
+  : DimUpdatedInfo(target.c_str(), &s_empty, sizeof(int)), handler(hdlr)
 {
-  targetService = target;
-  AdderFn  = addfn;
-  adderobj = addobj;
 }
 
-MonInfo::MonInfo(const std::string& target, void addfn(void*,void*, int, MonInfo *), void *addobj, int period=0)
-  : DIMTYPE(target.c_str(), period, &empty,4)
+MonInfo::MonInfo(const std::string& target, int period, MonInfoHandler* hdlr)
+  : DimUpdatedInfo(target.c_str(), period, &s_empty, sizeof(int)), handler(hdlr)
 {
-  targetService = target;
-  AdderFn = addfn;
-  adderobj = addobj;
 }
 
 void MonInfo::infoHandler()   {
   void *valin = getData();
   int   size  = getSize();
-  if (size == 4 && *(int*)valin == -1)    {
+  if (size == sizeof(int) && *(int*)valin == s_empty )    {
     return;
   }
-  else if ( ShutdowninProgress )   {
+  else if ( s_shutdowninProgress )   {
     return;
   }
-  else if ( AdderFn != 0 )   {
-    std::unique_ptr<unsigned char []> buff(new unsigned char[size]);
-    ::memcpy(buff.get(), valin, size);
-    (*AdderFn)(adderobj, buff.get(), size, this);
+  else if ( this->handler != nullptr )   {
+    mem_buff buffer(valin, size);
+    (*this->handler)(buffer.begin(), size, this);
   }
 }
diff --git a/Online/GauchoBase/src/MonSubSys.cpp b/Online/GauchoBase/src/MonSubSys.cpp
index 614a52152a00d76b08e9a48977de028758cac5fa..b3f062ccc05c7ab80186662de9d2472d8f9995c3 100644
--- a/Online/GauchoBase/src/MonSubSys.cpp
+++ b/Online/GauchoBase/src/MonSubSys.cpp
@@ -10,7 +10,9 @@
 //
 //==========================================================================
 #include <Gaucho/MonSubSys.h>
+#include <Gaucho/ObjService.h>
 #include <Gaucho/MonitorClass.h>
+#include <Gaucho/MonBase.h>
 #include <Gaucho/MonSys.h>
 
 using namespace Online;
@@ -18,32 +20,32 @@ using namespace Online;
 MonSubSys::MonSubSys(SubSysParams &p) : classMgr(p)  {
   this->runNumber = 0;
   this->type      = p.type;
-  this->classMap.clear();
   this->classMgr.runAware = p.runAware;
-  this->classMgr.setDefault(p);
 }
 
 MonSubSys::~MonSubSys()    {
+  locked_execution(this, [this]() { this->classMgr.clear(); });
+#if 0
   locked_execution(this, [this]() {
-      for (auto& i : this->objMap )
-	delete i.second;
-      this->objMap.clear();
+      if ( this->type == MONSUBSYS_Counter)    {
+	for (auto& i : this->objects )
+	  i.second->delete_OutputService();
+      }
+      this->objects.clear();
     });
-  MonSys::instance().remove(this);
+#endif
 }
 
 int MonSubSys::lock(void)    {
   int status = 1;
   while (status != 0)  {
     status = lockid.lockMutex();
-    if (status != 0)
-    {
+    if (status != 0)    {
 //      printf("Status from lock not success......\n");
     }
   }
   this->lockcount++;
-  if (this->lockcount != 1)
-  {
+  if (this->lockcount != 1)  {
 //    printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!Lock Counter != 1 after locking %d %d %d\n",m_lockcnt,m_lockcount,m_unlockcount);
   }
   return status;
@@ -54,8 +56,7 @@ int MonSubSys::unlock(void)   {
   this->unlockcount++;
   while (status != 0)    {
     status = lockid.unlockMutex();
-    if (status != 0)
-    {
+    if (status != 0)    {
 //      printf("Status from unlock not success......\n");
     }
   }
@@ -76,54 +77,12 @@ void MonSubSys::stop()  {
   }
 }
 
-void MonSubSys::add(MonBase* h)   {
-  auto i = this->classMgr.getMap().begin();
-  for (i=this->classMgr.getMap().begin();i!=this->classMgr.getMap().end();i++)  {
-    if (i->second->matchName(h->name))
-    {
-      break;
-    }
-  }
-  if (i == this->classMgr.getMap().end())
-  {
-    i = this->classMgr.getMap().find(MonitorClass::DefaultClassName);
-  }
-  i->second->add(h);
-  i->second->setType(this->type);
-}
-
-void MonSubSys::removeObj(MonBase* h)  {
-  if ( h ) {
-    this->objMap.erase(h->name);
-    this->numObjs--;
-  }
-}
-
-MonBase *MonSubSys::findobj(const std::string& nam)  {
-  auto i = this->objMap.find(nam);
-  return (i == this->objMap.end()) ? nullptr : i->second;
-}
-
-MonBase *MonSubSys::findEntity(const std::string& nam)   {
-  for (auto i : MonitorClass::ClassMap )  {
-    ObjMap& m = i.second->entities;
-    auto j = m.find(nam);
-    if ( j != m.end() )
-      return j->second;
-  }
-  return nullptr;
+size_t MonSubSys::removeAll(const std::string& owner_name)  {
+  return this->classMgr.removeAll(owner_name);
 }
 
 void MonSubSys::clear()  {
-  for( auto& i : this->objMap )
-    i.second->clear();
-}
-
-void MonSubSys::clear(const std::string& name)  {
-  if ( this->dontclear )
-    return;
-  else if ( MonBase *h = this->findobj(name) )
-    h->clear();
+  this->classMgr.clear();
 }
 
 void MonSubSys::EORUpdate(int runo)  {
@@ -143,11 +102,11 @@ void MonSubSys::setRunNo(int runno)   {
   this->classMgr.setRunNo(runno);
 }
 
-void MonSubSys::AddClass(std::string &nam, int intv, std::list<std::string>&sels)  {
-  this->classMgr.add(new MonitorClass(nam,intv,sels));
+void MonSubSys::addClass(std::string &nam, int intv, std::list<std::string>&sels)  {
+  this->addClass(std::move(std::make_shared<MonitorClass>(nam, intv, sels)));
 }
 
-void MonSubSys::AddClass(MonitorClass *c)  {
-  this->classMgr.add(c);
+void MonSubSys::addClass(std::shared_ptr<MonitorClass>&& c)  {
+  this->classMgr.add(std::move(c));
 }
 
diff --git a/Online/GauchoBase/src/MonSys.cpp b/Online/GauchoBase/src/MonSys.cpp
index 5b21fbdabdb141ef7daf70aa531bd70336bfd0ab..408b1271b928b1b317dae1f4dee01fcb950f54f8 100644
--- a/Online/GauchoBase/src/MonSys.cpp
+++ b/Online/GauchoBase/src/MonSys.cpp
@@ -20,43 +20,43 @@ MonSys::MonSys()  {
   state = "Constructed";
 }
 
-void MonSys::add(MonSubSys *ss)   {
-  for(auto* p : subSystems)  {
+void MonSys::add(std::shared_ptr<MonSubSys> ss)   {
+  for(auto& p : subSystems)  {
     if (p->type == ss->type)
       return;
   }
-  subSystems.insert(subSystems.end(),ss);
+  subSystems.insert(subSystems.end(),std::move(ss));
 }
 
 void MonSys::start()  {
   DimServer::setWriteTimeout(20);
   DimServer::autoStartOn();
   DimServer::start(name.c_str());
-  for(auto* p : subSystems)
+  for(auto& p : subSystems)
     p->start();
   state = "Started";
 }
 
 void MonSys::stop()  {
   DimServer::autoStartOff();
-  for(auto* p : subSystems)
+  for(auto& p : subSystems)
     p->stop();
   state = "Stopped";
 }
 
-void MonSys::remove(MonSubSys *ss)  {
-  auto it = std::find(subSystems.begin(), subSystems.end(), ss);
+void MonSys::remove(std::shared_ptr<MonSubSys> ss)  {
+  auto it = std::find(subSystems.begin(), subSystems.end(), std::move(ss));
   if ( it != subSystems.end() )
     subSystems.erase(it);
 }
 
 void MonSys::lock()  {
-  for(auto* p : subSystems)
+  for(auto& p : subSystems)
     p->lock();
 }
 
 void MonSys::unlock()   {
-  for(auto* p : subSystems)
+  for(auto& p : subSystems)
     p->unlock();
 }
 
@@ -72,27 +72,27 @@ MonSys *MonSys::setup(const std::string& n)  {
 }
 
 void MonSys::clear()   {
-  for(auto* p : subSystems)
+  for(auto& p : subSystems)
     p->clear();
 }
 
 void MonSys::update()  {
-  for(auto* p : subSystems)
+  for(auto& p : subSystems)
     p->update();
 }
 
 void MonSys::update(unsigned long ref)
 {
-  for(auto* p : subSystems)
+  for(auto& p : subSystems)
     p->update(ref);
 }
 
 void MonSys::EORUpdate(int runo)   {
-  for(auto* p : subSystems)
+  for(auto& p : subSystems)
     p->EORUpdate(runo);
 }
 
 void MonSys::setRunNo(int runo)   {
-  for(auto* p : subSystems)
+  for(auto& p : subSystems)
     p->setRunNo(runo);
 }
diff --git a/Online/GauchoBase/src/MonTimer.cpp b/Online/GauchoBase/src/MonTimer.cpp
index e2cf6dcc04b796366cae0cd8d567ab2224c6a345..4f7c88d998db134609a08cf72d15f073c23d131a 100644
--- a/Online/GauchoBase/src/MonTimer.cpp
+++ b/Online/GauchoBase/src/MonTimer.cpp
@@ -9,68 +9,48 @@
 // Author     : B.Jost
 //
 //==========================================================================
-#include "Gaucho/MonTimer.h"
-#include "Gaucho/MonitorClass.h"
-#include "Gaucho/MonSubSysTypes.h"
-#include "Gaucho/ObjService.h"
-#include "dim/dim_common.h"
+#include <Gaucho/MonTimer.h>
+#include <Gaucho/MonitorClass.h>
+#include <Gaucho/ObjService.h>
+#include <Gaucho/MonSubSys.h>
+#include <dim/dim_common.h>
 
 #include <stdexcept>
 
 using namespace Online;
 
-MonTimer::MonTimer(MonitorClass *HSys, int period) : GenTimer((void*)HSys,period*1000)
-{
+MonTimer::MonTimer(MonitorClass *HSys, int periodicity) : GenTimer((void*)HSys,periodicity*1000)   {
   m_Hsys = HSys;
   m_dueTime = 0;
   m_dontdimlock = true;
   this->m_lock.m_name = m_Hsys->name+"_MonTimerLock";
 }
 
-MonTimer::~MonTimer( )
-{
-}
-
-void MonTimer::timerHandler ( void )
-{
-//
-//  Context: separate thread.
-//  Timer lock held at entry
-//
+void MonTimer::timerHandler ( void )   {
   if (m_ForceExit) return;
-//  MonSubSys::_Lock l(m_Hsys,m_Hsys->m_type != MONSUBSYS_Counter);
   if (!m_dontdimlock) dim_lock();
   {
     bool need_return = false;
 
-    m_Hsys->m_genSrv->setRunNo(m_Hsys->m_runno);
-    m_Hsys->m_genSrv->setTime(m_dueTime);
-    try
-    {
+    m_Hsys->genSrv->setRunNo(m_Hsys->runNumber);
+    m_Hsys->genSrv->setTime(m_dueTime);
+    try    {
       m_Hsys->makeRates(m_lastdelta);
-      m_Hsys->m_genSrv->Serialize(int(m_period/1000));
+      m_Hsys->genSrv->serialize(int(this->period/1000));
     }
-    catch(const std::exception& e)
-    {
+    catch(const std::exception& e)    {
       ::printf("MonTimer: Exception:%s\n",e.what());
       need_return = true;
     }
-    catch(...)
-    {
+    catch(...)    {
       printf("MonTimer: Unknown Exception.\n");
       need_return = true;
     }
-    if ( need_return )
-    {
-      if (!m_dontdimlock) dim_unlock();
+    if ( need_return )    {
+      if ( !m_dontdimlock ) ::dim_unlock();
       return;
     }
   }
-  m_Hsys->m_genSrv->Update();
-  if (!m_dontdimlock) dim_unlock();
-}
-
-void MonTimer::stop()
-{
-  this->GenTimer::stop();
+  m_Hsys->genSrv->update();
+  if ( !m_dontdimlock ) ::dim_unlock();
 }
diff --git a/Online/GauchoBase/src/MonitorClass.cpp b/Online/GauchoBase/src/MonitorClass.cpp
index ba1d5f845319b66a20f749d5c7b4d9ac7a297b28..50ede73da0b5125f92d4e7ca8fe092eb9c7b4f39 100644
--- a/Online/GauchoBase/src/MonitorClass.cpp
+++ b/Online/GauchoBase/src/MonitorClass.cpp
@@ -9,231 +9,218 @@
 // Author     : B.Jost
 //
 //==========================================================================
-/*
- * MonitorClass.cpp
- *
- *  Created on: Feb 12, 2019
- *      Author: beat
- */
-
-#include "Gaucho/MonitorClass.h"
-#include "Gaucho/MonBase.h"
-#include "Gaucho/MonSubSysTypes.h"
-#include "Gaucho/MonTimer.h"
-#include "Gaucho/RateMgr.h"
+#include <Gaucho/MonitorClass.h>
+#include <Gaucho/ObjSerializer.h>
+#include <Gaucho/ObjService.h>
+#include <Gaucho/MonSubSys.h>
+#include <Gaucho/MonTimer.h>
+#include <Gaucho/MonBase.h>
+#include <Gaucho/RateMgr.h>
+#include <RTL/strdef.h>
 
 #include <limits>
+
 using namespace std;
 using namespace Online;
 
-map<string, MonitorClass*> MonitorClass::ClassMap;
 static long mpty;
 string MonitorClass::DefaultClassName = "**DEFAULT**";
 
 
-MonitorClass::MonitorClass(const string &id, int intv, list<string> &sel)
-{
+MonitorClass::MonitorClass(const string &id, int intv, list<string> &sel)   {
   this->ID = id;
-  this->m_interval = intv;
+  this->interval = intv;
   this->entityExpression = sel;
-  this->expandnames = false;
-  this->type = 0;
-  this->m_runno =0;
-
-  regex_constants::match_flag_type matchFlags;
-  matchFlags = (regex_constants::match_flag_type) regex_constants::icase
-//      | (regex_constants::match_flag_type) regex_constants::optimize
-//      | (regex_constants::match_flag_type) regex_constants::match_not_null
-      | (regex_constants::match_flag_type) regex_constants::ECMAScript
-      ;
-  for (auto i = sel.begin(); i != sel.end(); i++)  {
-    string s=*i;
-    regex *r=new regex(s, (regex_constants::syntax_option_type)matchFlags);
+  this->expand           = false;
+  this->type             = 0;
+  this->runNumber        = 0;
+
+  regex_constants::match_flag_type matchFlags = 
+    regex_constants::match_flag_type(regex_constants::icase | regex_constants::ECMAScript
+    //      | regex_constants::optimize | regex_constants::match_not_null
+				     );
+  for (const auto& s : sel )  {
+    regex *r = new regex(s, (regex_constants::syntax_option_type)matchFlags);
     m_Cregex.push_back(r);
   }
 }
-MonitorClass::~MonitorClass()
-{
-  deletePtr(m_EORsvc);
-  deletePtr(m_EORser);
-  deletePtr(m_genSrv);
-  deletePtr(m_ser);
-  deletePtr(this->rateManager);
+
+MonitorClass::~MonitorClass()    {
 }
-void MonitorClass::configure(int type)
-{
+
+//void MonitorClass::setType(int t)    {
+//  this->type = t;
+//}
+
+void MonitorClass::configure(int type)   {
   this->type = type;
   if (this->type == MONSUBSYS_Counter)  {
-    if (this->rateManager == 0)   {
-      this->rateManager = new RateMgr("Rates",0);
+    if ( !this->rateManager )   {
+      this->rateManager = std::make_unique<RateMgr>(this);
     }
   }
 }
 
-void MonitorClass::setup(const string& n, bool expandnames, const string &einfix)  {
-  expandInfix = einfix;
-  expandnames = expandnames;
-  name = n;
-  pname = RTL::processName();
+void MonitorClass::setup(const string& clazz_name, bool expnd, const string &infix)  {
   string nodename = RTL::nodeNameShort();
-  this->timer = new MonTimer(this, m_interval);
-  string nam = "MON_" + this->pname + "/" + this->name + "/HistCommand";
-  if (this->expandnames)  {
+  string utgid    = RTL::processName();
+  this->expandInfix = infix;
+  this->expand      = expnd;
+  this->name        = clazz_name;
+  this->timer = make_unique<MonTimer>(this, this->interval);
+
+  if ( this->expand )  {
     if (this->type == MONSUBSYS_Counter)   {
       for ( auto& h : this->entities )
         h.second->create_OutputService(expandInfix);
     }
   }
   if (runAware)
-    this->m_ServiceFMT = "MON_"+this->pname+"/"+this->name+"/<runno>/Data";
+    this->serviceFMT = "MON_"+utgid+"/"+this->name+"/<runno>/Data";
   else
-    this->m_ServiceFMT = "MON_"+this->pname+"/"+this->name+"/Data";
+    this->serviceFMT = "MON_"+utgid+"/"+this->name+"/Data";
 
-  nam = m_ServiceFMT;
-  string rn = to_string(m_runno);
-  StringReplace(nam,"<runno>",rn);
+  string run = to_string(this->runNumber);
+  string nam = RTL::str_replace(this->serviceFMT, "<runno>", run);
 
   if (this->ID != MonitorClass::DefaultClassName)
     nam += "."+this->ID;
 
-  m_lockid.m_name = nam;
-  if (m_ser == 0)
-    this->m_ser = new ObjSerializer(&this->entities, this->expandnames);
-  if (m_genSrv == 0)
-    this->m_genSrv = new ObjService(m_ser, nam, "C", &mpty, 4);
-
-  if (this->expandnames)
-    this->m_genSrv->expand = this->expandnames;
-
-  nam = nam = string("MON_") + this->pname + "/" + this->name + "/EOR";
-  if (this->ID != MonitorClass::DefaultClassName)
-    nam = string("MON_") + this->pname + "/" + this->name + "/EOR." + this->ID;
-
-  if (m_EORser == 0)
-    this->m_EORser = new ObjSerializer(&this->entities, false);
-  if (m_EORsvc == 0)
-    this->m_EORsvc = new ObjService(this->m_EORser, nam, "C", &mpty, 4);
-
-  this->m_EORsvc->setEORflag(true);
+  this->lockid.m_name = nam;
+  if ( !this->genSrv )    {
+    this->genSrv = make_unique<ObjService>(make_unique<ObjSerializer>(this, this->expand), nam, "C", &mpty, 4);
+  }
+  if ( !this->eor_service )   {
+    nam = nam = "MON_" + utgid + "/" + this->name + "/EOR";
+    if (this->ID != MonitorClass::DefaultClassName)
+      nam = "MON_" + utgid + "/" + this->name + "/EOR." + this->ID;
+    this->eor_service = make_unique<ObjService>(make_unique<ObjSerializer>(this, false), nam, "C", &mpty, 4);
+  }
+  this->eor_service->setEORflag(true);
 }
 
-void MonitorClass::start()
-{
-  if (this->timer) this->timer->start();
+void MonitorClass::start()   {
+  if ( this->timer ) this->timer->start();
 }
 
-void MonitorClass::stop()
-{
-  if (this->timer) this->timer->stop();
-  if (this->rateManager != 0)    {
-    this->m_genSrv->setRunNo(m_runno);
+void MonitorClass::stop()    {
+  if ( this->timer )  {
+    this->timer->stop();
+  }
+  if ( this->rateManager )    {
+    this->genSrv->setRunNo(this->runNumber);
     this->rateManager->zero();
   }
   this->update();
 }
 
-void MonitorClass::add(MonBase *m)   {
-  this->entities[m->name] = m;
+void MonitorClass::add(std::unique_ptr<MonBase>&& m)   {
+  if ( m )   {
+    auto i = this->entities.find(m->name);
+    if ( i != this->entities.end() )
+      i->second->delete_OutputService();
+    this->entities[m->name] = std::move(m);
+  }
 }
 
-MonBase *MonitorClass::remove(const string &nam)  {
-  auto i = this->entities.find(nam);
-  if ( i != this->entities.end() )   { 
-    MonBase *r = i->second;
-    this->entities.erase(i);
-    return r;
+size_t MonitorClass::clear()   {
+  size_t ret = this->entities.size();
+  for(auto& i : this->entities )
+    i.second->delete_OutputService();
+  this->entities.clear();
+  return ret;
+}
+
+size_t MonitorClass::clearAll(const std::string &owner_name)    {
+  if ( owner_name.size() == 0 || owner_name == "*" )    {
+    return this->clear();
+  }
+  size_t ret = 0;
+  std::vector<std::string> items;
+  items.reserve(this->entities.size());
+  for ( auto& i : this->entities )   {
+    if ( i.first.find(owner_name) != std::string::npos )
+      items.push_back(i.first);
+  }
+  for ( auto& i : items )   {
+    auto iter = this->entities.find(i);
+    iter->second->delete_OutputService();
+    this->entities.erase(iter);
+    ++ret;
   }
-  return nullptr;
+  return ret;
 }
 
-MonitorClass *MonitorClass::GetClass(const string &id)   {
-  auto it = ClassMap.find(id);
-  return (it != ClassMap.end()) ? it->second : nullptr;
+std::unique_ptr<MonBase> MonitorClass::remove(const std::string &nam)   {
+  std::unique_ptr<MonBase> ret;
+  auto i = this->entities.find(nam);
+  if ( i != this->entities.end() )   {
+    ret.reset(i->second.release());
+    this->entities.erase(i);
+  }
+  return ret;
 }
 
-bool MonitorClass::matchName(const string &nam)
-{
+bool MonitorClass::matchName(const string &nam)  {
 //  regex_constants::match_flag_type matchFlags;
 //  matchFlags = (regex_constants::match_flag_type) regex_constants::icase;
 //      | (regex_constants::match_flag_type) regex_constants::optimize
 //      | (regex_constants::match_flag_type) regex_constants::match_not_null;
-  for (auto i = m_Cregex.begin(); i != m_Cregex.end(); i++)
-  {
+  for (auto i = m_Cregex.begin(); i != m_Cregex.end(); i++)  {
     smatch sm;
     regex *r = *i;
-    bool stat = regex_match(nam, sm, *r);
-    if (stat)
-    {
+    bool stat = ::regex_match(nam, sm, *r);
+    if (stat)    {
       return stat;
     }
   }
   return false;
 }
 
-void MonitorClass::makeRates(unsigned long dt)
-{
-  if (this->rateManager != 0) this->rateManager->makeRates(dt);
+void MonitorClass::makeRates(unsigned long dt)   {
+  if ( this->rateManager ) this->rateManager->makeRates(dt);
 }
 
-void MonitorClass::setRunNo(unsigned int runno)
-{
-  string nam;
-  if (!runAware)
-  {
-    m_runno = runno;
+void MonitorClass::setRunNo(unsigned int runno)  {
+  if ( !runAware )  {
+    this->runNumber = runno;
     return;
   }
-
-  if (runno != m_runno)
-  {
-    if (m_genSrv == 0 )
-    {
-      m_runno = runno;
+  if ( runno != this->runNumber )   {
+    if (this->genSrv == 0 )    {
+      this->runNumber = runno;
       return;
     }
-    nam = m_ServiceFMT;
-    string rn;
-    rn = to_string(runno);
-    StringReplace(nam,"<runno>",rn);
-
-    if (this->ID.size()!= 0)
-    {
+    string run = to_string(runno);
+    string nam = RTL::str_replace(this->serviceFMT, "<runno>", run);
+    if ( this->ID.size() != 0 )   {
       nam += "."+this->ID;
     }
-    ObjService *svc = new ObjService(m_ser, nam.c_str(), "C", &mpty, 4);
-    ObjService *tsvc = m_genSrv;
-    m_genSrv = svc;
-    deletePtr(tsvc);
-    m_genSrv->setRunNo(runno);
+    this->genSrv = make_unique<ObjService>(make_unique<ObjSerializer>(this, this->expand), nam.c_str(), "C", &mpty, 4);
+    this->genSrv->setRunNo(runno);
   }
-  m_runno = runno;
+  this->runNumber = runno;
 }
 
-void MonitorClass::EORUpdate(int runo)
-{
-  m_EORsvc->setRunNo(runo);
-  setRunNo(runo);
-  locked_execution(this, [this]() { this->m_EORsvc->Serialize(0); });
-  m_EORsvc->Update();
+void MonitorClass::EORUpdate(int runo)   {
+  this->eor_service->setRunNo(runo);
+  this->setRunNo(runo);
+  locked_execution(this, [this]() { this->eor_service->serialize(0); });
+  this->eor_service->update();
 }
 
 void MonitorClass::update()  {
   locked_execution(this, [this]() {
-      m_genSrv->setRunNo(m_runno);
-      m_genSrv->Serialize(0);
+      this->genSrv->setRunNo(this->runNumber);
+      this->genSrv->serialize(0);
     });
-  m_genSrv->Update();
+  this->genSrv->update();
 }
 
 void MonitorClass::update(unsigned long ref)  {
   long r = ref;
-  m_genSrv->setRunNo(m_runno);
-  m_genSrv->setTime(r);
-  locked_execution(this, [this]() { this->m_genSrv->Serialize(0); });
-  m_genSrv->Update();
-}
-
-void MonitorClass::addRateMgr(RateMgr *m)
-{
-  this->rateManager = m;
+  this->genSrv->setRunNo(this->runNumber);
+  this->genSrv->setTime(r);
+  locked_execution(this, [this]() { this->genSrv->serialize(0); });
+  this->genSrv->update();
 }
diff --git a/Online/GauchoBase/src/MonitorInterface.cpp b/Online/GauchoBase/src/MonitorInterface.cpp
index ad603e732f02bfcdde885a3f2dfe2b923a7ea65e..63d1fa51032a9101e8ba88ab7c1a21df5806757c 100644
--- a/Online/GauchoBase/src/MonitorInterface.cpp
+++ b/Online/GauchoBase/src/MonitorInterface.cpp
@@ -13,7 +13,9 @@
 #include "Gaucho/MonitorInterface.h"
 #include "Gaucho/MonitorClass.h"
 #include "Gaucho/TaskSaveTimer.h"
+#include "Gaucho/ObjService.h"
 #include "Gaucho/MonSys.h"
+#include <RTL/strdef.h>
 #include <atomic>
 
 using namespace Online;
@@ -21,18 +23,19 @@ using namespace Online;
 MonitorInterface::MonitorInterface(const std::string &utgid, SubSysParams&& cntpars, SubSysParams&& histpars)
   : m_CntrPars(cntpars), m_HistPars(histpars), m_UTGID(utgid)
 {
-  m_MonSys   = &MonSys::instance();
-  m_runAware = m_CntrPars.runAware;
+  m_runAware      = m_CntrPars.runAware;
   m_CntrPars.type = MONSUBSYS_Counter;
-  m_CntrSubSys.reset(new CounterSubSys(m_CntrPars));
-  m_MonSys->add(m_CntrSubSys.get());
+  m_CntrSubSys    = std::make_shared<CounterSubSys>(m_CntrPars);
+  MonSys::instance().add(m_CntrSubSys);
 
-  histpars.type = MONSUBSYS_Histogram;
-  m_HistSubSys.reset(new HistSubSys(histpars));
-  m_MonSys->add(m_HistSubSys.get());
+  histpars.type   = MONSUBSYS_Histogram;
+  m_HistSubSys    = std::make_shared<HistSubSys>(histpars);
+  MonSys::instance().add(m_HistSubSys);
 }
 
 MonitorInterface::~MonitorInterface()   {
+  MonSys::instance().remove(m_CntrSubSys);
+  MonSys::instance().remove(m_HistSubSys);
 }
 
 void MonitorInterface::i_unsupported(const std::string& /*name*/,
@@ -40,169 +43,118 @@ void MonitorInterface::i_unsupported(const std::string& /*name*/,
 {
 }
 
-void MonitorInterface::undeclare(const std::string& entry)   {
-  auto it = m_InfoMap.find(entry);
-  if (it != m_InfoMap.end())  {
-    MonSubSys* s = it->second;
-    MonBase*   o = s->findobj(entry.c_str());
-    if (s->type == MONSUBSYS_Counter)     {
-      s->remove(entry);
-    }
-    else if (s->type == MONSUBSYS_Histogram)     {
-      s->removeObj(o);
-      delete o;
-    }
-    m_InfoMap.erase(entry);
-  }
+size_t MonitorInterface::undeclare(const std::string& entry)   {
+  size_t removed = 0;
+  if ( m_HistSubSys )
+    removed = m_HistSubSys->remove(entry);
+  if ( !removed && m_CntrSubSys )
+    removed = m_CntrSubSys->remove(entry);
+  return removed;
 }
 
-void MonitorInterface::undeclareAll(std::string &oname)  {
-  bool all = oname.size() == 0;
-  std::vector<std::string> strings;
-  std::string nam;
-//  if (m_RateMgr != 0)
-//  {
-//    m_RateMgr->removeRateAll(m_CntrSubSys);
-//  }
-  if (m_HistSubSys != 0)  {
-    std::vector<MonBase*> v;
+size_t MonitorInterface::undeclareAll(std::string &oname)  {
+  size_t removed = 0;
+  if ( m_HistSubSys )  {
     m_HistSubSys->stop();
-    for (auto it : m_HistSubSys->objMap)   {
-      MonBase *o = it.second;
-      if (all || o->name.find(oname.c_str()) != std::string::npos)
-        v.push_back(o);;
-    }
-    for (unsigned int i=0;i<v.size();i++)    {
-      m_HistSubSys->removeObj(v[i]);
-      m_InfoMap.erase(v[i]->name);
-      delete v[i];
-    }
+    removed += m_HistSubSys->removeAll(oname);
   }
-
-  if (m_CntrSubSys != 0)  {
-    std::vector<MonBase*> v;
+  if ( m_CntrSubSys )  {
     m_CntrSubSys->stop();
-    for (auto ent : m_CntrSubSys->entrySet)  {
-      MonBase *o = m_CntrSubSys->objMap[ent];
-      if (all || o->name.find(oname.c_str()) != std::string::npos)
-	v.push_back(o);
-    }
-    for (unsigned int i=0;i<v.size();i++)    {
-      const std::string& n = v[i]->name;
-      m_InfoMap.erase(n);
-      m_CntrSubSys->remove(n);
-    }
+    removed += m_CntrSubSys->removeAll(oname);
   }
+  return removed;
 }
+
 int MonitorInterface::start()   {
-    DimServer::autoStartOff();
-    if (m_MonSys != &MonSys::instance())    {
-      m_MonSys = &MonSys::instance();
-      m_monsysrecover++;
-    }
-    if (m_started)    {
-      m_MonSSysSize = m_MonSys->subSystems.size();
-      m_MonSys->start();
-      DimServer::autoStartOn();
-  //    DimServer::start();
-      return 1;
-    }
-    if (m_MonSys     != 0) m_MonSys->setup(this->m_UTGID.c_str());
-    if (m_CntrSubSys != 0) m_CntrSubSys->setup("Counter",this->m_CntrPars.expandnames);
-    if (m_HistSubSys != 0) m_HistSubSys->setup("Histos");
+  DimServer::autoStartOff();
+  if (m_started)    {
+    MonSys::instance().start();
     DimServer::autoStartOn();
-    DimServer::start();
-    m_MonSSysSize = m_MonSys->subSystems.size();
-    m_MonSys->start();
-    m_started = true;
+    //    DimServer::start();
     return 1;
-
-}
-int MonitorInterface::stop()   {
-  if (m_MonSys)
-  {
-    m_MonSys->stop();
   }
+  MonSys::instance().setup(this->m_UTGID.c_str());
+  if (m_CntrSubSys != 0) m_CntrSubSys->setup("Counter",this->m_CntrPars.expandnames);
+  if (m_HistSubSys != 0) m_HistSubSys->setup("Histos");
+  DimServer::autoStartOn();
+  DimServer::start();
+  MonSys::instance().start();
+  m_started = true;
   return 1;
+}
 
+int MonitorInterface::stop()   {
+  MonSys::instance().stop();
+  return 1;
 }
 
-void MonitorInterface::ApplyCouterClasses(std::vector<std::string> &m_CounterClasses)
-{
-  if (m_CounterClasses.size() > 0)  {
-    std::list<MonitorClass*> clist;
-    MakeClassList(clist, m_CounterClasses);
-    for (auto i = clist.begin(); i != clist.end(); i++)   {
-      (*i)->setType(MONSUBSYS_Counter);
-      (*i)->configure(MONSUBSYS_Counter);
-      (*i)->runAware = m_CntrPars.runAware;
-      m_CntrSubSys->AddClass(*i);
+void MonitorInterface::ApplyCouterClasses(std::vector<std::string> &options)  {
+  if (options.size() > 0)  {
+    auto clist = this->makeClassList(options);
+    for ( auto& cl : clist )    {
+      cl->configure(MONSUBSYS_Counter);
+      cl->runAware = m_CntrPars.runAware;
+      m_CntrSubSys->addClass(std::move(cl));
     }
   }
 }
-void MonitorInterface::ApplyHistogramClasses(std::vector<std::string> &cls)
-{
-  if (cls.size() > 0)
-  {
-    std::list<MonitorClass*> clist;
-    MakeClassList(clist, cls);
-    for (auto i = clist.begin(); i != clist.end(); i++)
-    {
-      (*i)->setType((int)MONSUBSYS_Histogram);
-      (*i)->configure((int)MONSUBSYS_Histogram);
-      (*i)->runAware = m_HistPars.runAware;
-      m_HistSubSys->AddClass(*i);
+
+void MonitorInterface::ApplyHistogramClasses(std::vector<std::string> &options)  {
+  if (options.size() > 0)  {
+    auto clist = this->makeClassList(options);
+    for ( auto& cl : clist )    {
+      cl->configure(MONSUBSYS_Histogram);
+      cl->runAware = m_HistPars.runAware;
+      m_HistSubSys->addClass(std::move(cl));
     }
   }
 }
-void MonitorInterface::MakeClassList(std::list<MonitorClass*> &target, std::vector<std::string> &option)
-{
+
+std::list<std::shared_ptr<MonitorClass> > MonitorInterface::makeClassList(std::vector<std::string> &option) const  {
   /*
    * Class Definition Option Syntax:
    * "<Class Name><blank><update interval><blank> list of regular expressions separated by <blanks>"
    */
   std::string name, def;
-  for (size_t i = 0; i < option.size(); i++)
-  {
+  std::list<std::shared_ptr<MonitorClass> > result;
+  for (size_t i = 0; i < option.size(); i++)  {
     int intv = 0;
     std::list<std::string> l;
-    std::unique_ptr<dyn_string> op(Strsplit(option[i].c_str(), " "));
-    if (op->size() != 0)
-    {
-      name = op->at(0);
-      ::sscanf(op->at(1).c_str(), "%d", &intv);
-      for (size_t j = 2; j < op->size(); j++)
-      {
-        l.insert(l.end(), op->at(j));
-      }
+    auto op = RTL::str_split(option[i].c_str(), " ");
+    if ( op.size() > 1 )   {
+      name = op[0];
+      ::sscanf(op[1].c_str(), "%d", &intv);
+      for (size_t j = 2; j < op.size(); j++)
+        l.insert(l.end(), op.at(j));
     }
-    target.insert(target.end(), new MonitorClass(name, intv, l));
+    result.insert(result.end(), std::make_shared<MonitorClass>(name, intv, l));
   }
+  return result;
 }
 
 void MonitorInterface::setRunNo(int runno)  {
   m_runnr = runno;
-  m_MonSys->setRunNo(runno);
+  MonSys::instance().setRunNo(runno);
 }
 
 void MonitorInterface::EORUpdate(int runno)   {
-  m_MonSys->EORUpdate(runno);
+  MonSys::instance().EORUpdate(runno);
 }
 
 void MonitorInterface::Update(unsigned long ref)  {
-  m_MonSys->update(ref);
+  MonSys::instance().update(ref);
 }
 
 void MonitorInterface::resetHistos()  {
-  m_MonSys->clear();
+  MonSys::instance().clear();
 }
 
 void MonitorInterface::Lock(void)   {
-  m_MonSys->lock();
+  MonSys::instance().lock();
 }
 
 void MonitorInterface::UnLock(void)   {
-  m_MonSys->unlock();
+  MonSys::instance().unlock();
 }
 
 void MonitorInterface::StartSaving(const std::string &dir,
@@ -210,18 +162,17 @@ void MonitorInterface::StartSaving(const std::string &dir,
 				   const std::string &task,
 				   int period, DimService *sav)
 {
-  if (m_savetimer == 0)
-  {
-    m_savetimer = new TaskSaveTimer(m_HistSubSys.get(),period);
-    m_savetimer->setPartName(part);
-    m_savetimer->setRootDir(dir);
-    m_savetimer->setTaskName(task);
-    m_savetimer->setService(sav);
-    m_savetimer->setMonSys(m_MonSys);
+  if ( !m_saveTimer )  {
+    m_saveTimer = std::make_unique<TaskSaveTimer>(m_HistSubSys,period);
+    m_saveTimer->setPartName(part);
+    m_saveTimer->setRootDir(dir);
+    m_saveTimer->setTaskName(task);
+    m_saveTimer->setService(sav);
   }
-  m_savetimer->start();
+  m_saveTimer->start();
 }
-void MonitorInterface::StopSaving()
-{
-  if ( m_savetimer ) m_savetimer->stop();
+
+void MonitorInterface::StopSaving()  {
+  if ( m_saveTimer ) m_saveTimer->stop();
+  m_saveTimer.reset();
 }
diff --git a/Online/GauchoBase/src/ObjRPC.cpp b/Online/GauchoBase/src/ObjRPC.cpp
index f4c70253cd5dae8d8496e5b7c92fb222656825cf..99ef303061d5d92d6604770b5320165bd8827c6f 100644
--- a/Online/GauchoBase/src/ObjRPC.cpp
+++ b/Online/GauchoBase/src/ObjRPC.cpp
@@ -9,179 +9,72 @@
 // Author     : B.Jost
 //
 //==========================================================================
-#include "Gaucho/ObjRPC.h"
-#include "Gaucho/MonSys.h"
-#include "Gaucho/MonSubSys.h"
-#include "Gaucho/Utilities.h"
+#include <Gaucho/ObjRPC.h>
+#include <Gaucho/MonSys.h>
+#include <Gaucho/MonSubSys.h>
+#include <Gaucho/dimhist.h>
+#include <RTL/strdef.h>
 
 #include <cstdio>
 #include <vector>
 
 using namespace Online;
 
-ObjRPC::~ObjRPC()
+ObjRPC::ObjRPC(std::unique_ptr<Serializer>&& srv, 
+	       const std::string& n, const char *f_in, const char *f_out, 
+	       BRTLLock *mlid, BRTLLock *olid)
+  : DimRpc(n.c_str(), f_in, f_out), dns(), serializer(std::move(srv)), maplock(mlid), objlock(olid)
 {
-  if (buffersize >0)
-  {
-    free (buffer);
-  }
-}
-
-ObjRPC::ObjRPC(ObjSerializer *srv, const std::string& n, const char *f_in, const char *f_out) : DimRpc(n.c_str(), f_in, f_out)
-{
-  s = srv;
-  buffersize = 0;
-  buffer = 0;
-  m_maplockid = 0;
-  m_objlockid = 0;
-}
-ObjRPC::ObjRPC(ObjSerializer *srv, const std::string& n, const char *f_in, const char *f_out, BRTLLock *mlid, BRTLLock *olid) : DimRpc(n.c_str(), f_in, f_out)
-{
-  s = srv;
-  buffersize = 0;
-  buffer = 0;
-  m_maplockid = mlid;
-  m_objlockid = olid;
-}
-
-ObjRPC::ObjRPC(DimServerDns *dns,ObjSerializer *srv, const std::string& n, const char *f_in, const char *f_out) : DimRpc(dns,n.c_str(), f_in, f_out)
-{
-  s = srv;
-  buffersize = 0;
-  buffer = 0;
-  m_maplockid = 0;
-  m_objlockid = 0;
 }
 
-ObjRPC::ObjRPC(DimServerDns *dns,ObjSerializer *srv, const std::string& n, const char *f_in, const char *f_out, BRTLLock *mlid, BRTLLock *olid) : DimRpc(dns,n.c_str(), f_in, f_out)
+ObjRPC::ObjRPC(std::shared_ptr<DimServerDns> d,
+	       std::unique_ptr<Serializer>&& s, 
+	       const std::string& n, const char *f_in, const char *f_out, 
+	       BRTLLock *mlid, BRTLLock *olid)
+  : DimRpc(d.get(), n.c_str(), f_in, f_out), dns(std::move(d)), serializer(std::move(s)), maplock(mlid), objlock(olid)
 {
-  s = srv;
-  buffersize = 0;
-  buffer = 0;
-  m_maplockid = mlid;
-  m_objlockid = olid;
 }
 
-void ObjRPC::rpcHandler()
-{
-  RPCReply *reply = nullptr;
-  int status;
-  void * ptr = nullptr;
-  void* p = getData();
-  RPCComm *comm  = (RPCComm*)p;
-  RPCCommType Comm = comm->c;
-  size_t siz = sizeof(RPCReply);
+void ObjRPC::rpcHandler()   {
+  RPCComm *comm  = (RPCComm*)getData();
 
-  if (m_maplockid !=0)
-  {
-    m_maplockid->lockMutex();
-  }
-  switch (Comm)
+  std::pair<size_t, void*> result;
   {
-  case RPCCRead:
-    {
-      void *pp;
-      char *hlist=(char *)AddPtr(comm,sizeof(comm->c));
-      size_t bs = siz;
-      dyn_string *nams;
-      nams = Strsplit(hlist,(char*)"\n");
-      if (m_objlockid != 0)
-      {
-        m_objlockid->lockMutex();
-      }
-      ptr = s->SerializeObj(*nams,pp,bs);
-      if (m_objlockid != 0)
-      {
-        m_objlockid->unlockMutex();
-      }
-      siz = bs;
-      status = 0;
-      break;
+    BRTLLock::_Lock mlock(this->maplock);
+    
+    if ( comm->c == RPCCRead )    {
+      BRTLLock::_Lock lock(this->objlock);
+      auto nams = RTL::str_split(add_ptr<char>(comm,sizeof(comm->c)), "\n");
+      result = serializer->serialize_obj(nams, sizeof(RPCReply));
     }
-  case RPCCClear:
-    {
-      void *pp;
-      char *hlist=(char *)AddPtr(comm,sizeof(comm->c));
-      size_t bs = siz;
-      dyn_string *nams = Strsplit(hlist,(char*)"\n");
-      if (m_objlockid != 0) m_objlockid->lockMutex();
-      ptr = s->SerializeObj(*nams,pp,bs,true);
-      if (m_objlockid != 0) m_objlockid->unlockMutex();
-      siz = bs;
-      status = 0;
-      break;
+    else if ( comm->c == RPCCClear )    {
+      BRTLLock::_Lock lock(this->objlock);
+      auto nams = RTL::str_split(add_ptr<char>(comm,sizeof(comm->c)), "\n");
+      result = serializer->serialize_obj(nams, sizeof(RPCReply), true);
     }
-  case RPCCClearAll:
-    {
-      size_t bs = sizeof(RPCReply);
-      void *pp;
-      if (m_objlockid != 0)
-      {
-        m_objlockid->lockMutex();
-      }
-      ptr = s->SerializeObj(pp,bs,true);
-      if (m_objlockid != 0)
-      {
-        m_objlockid->unlockMutex();
-      }
-      siz = bs;
-      status = 0;
-      break;
+    else if ( comm->c == RPCCClearAll )   {
+      BRTLLock::_Lock lock(this->objlock);
+      result = serializer->serialize_obj(sizeof(RPCReply), true);
     }
-  case RPCCReadAll:
-    {
-      size_t bs = sizeof(RPCReply);
-      void *pp;
-      if (m_objlockid != 0)
-      {
-        m_objlockid->lockMutex();
-      }
-      ptr = s->SerializeObj(pp,bs);
-      if (m_objlockid != 0)
-      {
-        m_objlockid->unlockMutex();
-      }
-      siz = bs;
-      status = 0;
-      break;
+    else if ( comm->c == RPCCReadAll )    {
+      BRTLLock::_Lock lock(this->objlock);
+      result = serializer->serialize_obj(sizeof(RPCReply));
     }
-  case RPCCDirectory:
-    {
-      void *pp;
-      size_t bs = sizeof(RPCReply);
-      ptr = s->SerializeDir(pp,bs);
-      siz = bs;
-      status = 0;
-      break;
+    else if ( comm->c == RPCCDirectory )    {
+      BRTLLock::_Lock lock(this->objlock);
+      result = serializer->serialize_dir(sizeof(RPCReply));
     }
-  case RPCCIllegal:
-  default:
-    {
-      siz = sizeof(RPCReply);
-      ptr = malloc(siz);
-      Comm = RPCCIllegal;
-      status = -2;
-      reply = (RPCReply*)ptr;
-      reply->status = status;
-      reply->comm = Comm;
-      setData(ptr, siz);
-      free(ptr);
-      if (m_maplockid !=0)
-      {
-        m_maplockid->unlockMutex();
-      }
+    else   {
+      RPCReply reply;
+      reply.status = -2;
+      reply.comm = RPCCIllegal;
+      setData(&reply, sizeof(RPCReply));
+      if (this->maplock !=0) this->maplock->unlockMutex();
       return;
-      break;
     }
   }
-  if (m_maplockid !=0)
-  {
-    m_maplockid->unlockMutex();
-  }
-
-  reply = (RPCReply*)ptr;
-  reply->status = status;
-  reply->comm = Comm;
-  setData(ptr, siz);
-  return;
+  RPCReply *reply = (RPCReply*)result.second;
+  reply->status = 0;
+  reply->comm = comm->c;
+  setData(result.second, result.first);
 }
diff --git a/Online/GauchoBase/src/ObjSerializer.cpp b/Online/GauchoBase/src/ObjSerializer.cpp
index 81fe52207252520e70ae4e74774f9c8de9b9bb63..5c85c87c10faaa371ba3f6c5c65ed1541fd1513d 100644
--- a/Online/GauchoBase/src/ObjSerializer.cpp
+++ b/Online/GauchoBase/src/ObjSerializer.cpp
@@ -9,151 +9,173 @@
 // Author     : B.Jost
 //
 //==========================================================================
-#include "stdlib.h"
-#include "Gaucho/ObjSerializer.h"
-#include "Gaucho/MonBase.h"
-#include "Gaucho/dimhist.h"
-#include "Gaucho/MonTypes.h"
-#include "dim/dis.hxx"
+#include <Gaucho/ObjSerializer.h>
+#include <Gaucho/MonitorClass.h>
+#include <Gaucho/MonClassMgr.h>
+#include <Gaucho/MonBase.h>
+#include <Gaucho/dimhist.h>
+#include <dim/dis.hxx>
 #include <stdexcept>
 
 using namespace Online;
 
-typedef ObjMap::iterator SysIter;
+namespace {
+  void check_serial_buffers(...)   {}
+#if 0
+  void check_serial_buffers(void* ptr, size_t total_size, size_t len, const MonBase* h)   {
+    void* buffer_end = add_ptr(ptr, len);
+    void* buffer_tot = add_ptr(ptr, total_size);
+    if ( buffer_end > buffer_tot )   {
+      throw std::runtime_error("!!!!!!!!!!!!!!! BUFFER OVERFLOW serializing MonObject "+h->name);
+    }
+  }
+#endif
+}
 
-ObjSerializer::ObjSerializer(ObjMap *m, bool expnd)
-{
-  m_objmap = m;
-  this->expand = expnd;
+ObjSerializer::ObjSerializer(MonClassMgr* m, bool expnd) : manager(m), expand(expnd)  {
 }
 
-ObjSerializer::~ObjSerializer(void)   { // Should this not go to ObjSerializer ???
-  if (buffer != 0)  {
-    ::free(buffer);
-    buffer = 0;
-    buffersize = 0;
-  }
+ObjSerializer::ObjSerializer(MonitorClass* cl, bool expnd) : monitorClass(cl), expand(expnd)  {
 }
 
-void *ObjSerializer::SerializeObj(void *&ptr, size_t &siz, bool clear)   {
-  size_t bs = siz;
-  for ( auto& i : *m_objmap )  {
-    MonBase *h = i.second;
-    bs += (h == nullptr) ? sizeof(DimBuffBase) : h->xmitbuffersize();
+std::vector<MonBase*> ObjSerializer::collect()   const    {
+  std::vector<MonBase*> result;
+  result.reserve(1024);
+  if ( monitorClass )    {
+    for ( auto& j : monitorClass->entities )
+      result.push_back(j.second.get());
   }
-  ptr = Allocate(bs);
-  void* pp  = AddPtr(ptr,siz);
-  void* p1  = AddPtr(ptr,bs);
-  siz = bs;
-  for ( auto& i : *m_objmap )  {
-    MonBase *h = i.second;
-    h->Serialize(pp);
-    if (pp > p1)      {
-      throw std::runtime_error("!!!!!!!!!!!!!!! BUFFER OVERFLOW serializing Histogram "+h->name);
+  if ( manager )   {
+    for( auto& i : this->manager->getMap() )   {
+      for ( auto& j : i.second->entities )
+	result.push_back(j.second.get());
     }
-    if (clear)
-      h->clear();
   }
-  return ptr;
+  return result;
 }
 
-MonBase *ObjSerializer::findobj(const std::string& nam)    {
-  SysIter i = m_objmap->find(nam);
-  return (i == m_objmap->end()) ? nullptr : i->second;
+MonBase* ObjSerializer::find(const std::string& name)  const  {
+  if ( monitorClass )    {
+    for ( auto& j : monitorClass->entities )
+      if ( j.second->name == name ) return j.second.get();
+  }
+  if ( manager )   {
+    for( auto& i : this->manager->getMap() )   {
+      for ( auto& j : i.second->entities )
+	if ( j.second->name == name ) return j.second.get();
+    }
+  }
+  return nullptr;
 }
 
-void *ObjSerializer::SerializeObj(std::vector<std::string> &nams,void * &ptr,size_t& siz, bool clear)   {
-  size_t bs = siz;
-  for (unsigned int i=0;i<nams.size();i++)  {
-    MonBase *h = this->findobj(nams[i].c_str());
-    bs += (h == nullptr) ? sizeof(DimBuffBase) : h->xmitbuffersize();
+std::pair<size_t,void*> ObjSerializer::serialize_obj(const std::string& name, size_t offset, bool clear)   {
+  auto* h = this->find(name);
+  if ( !h )  {
+    return std::make_pair(offset,this->buffer.allocate(offset));
   }
-  ptr = Allocate(bs);
-  void* pp   = AddPtr(ptr,siz);
-  void* pend = AddPtr(ptr,bs);
-  siz = bs;
-  for ( const auto& nam : nams )   {
-    MonBase *h = this->findobj(nam);
-    if (h != 0)    {
-      h->Serialize(pp);
-      if ( pp > pend )   {
-	throw std::runtime_error("!!!!!!!!!!!!!!! BUFFER OVERFLOW serializing Histogram "+h->name);
-      }
-      if (clear)      {
-        h->clear();
-      }
+  size_t total_size = offset + h->xmitbuffersize();
+  void*  ptr = this->buffer.allocate(total_size);
+  size_t len = h->serialize(add_ptr(ptr, offset));
+  check_serial_buffers(ptr, total_size, len, h);
+  if (clear) h->clear();
+  return std::make_pair(total_size,ptr);
+}
+
+std::pair<size_t,void*> ObjSerializer::serialize_obj(size_t offset, bool clear)   {
+  size_t total_size = offset;
+  auto objects = this->collect();
+  for ( auto* i : objects )
+    total_size += i ? i->xmitbuffersize() : sizeof(DimBuffBase);
+
+  void*  ptr        = this->buffer.allocate(total_size);
+  void*  buffer_ptr = add_ptr(ptr, offset);
+  size_t len = 0;
+  for ( auto* h : objects )  {
+    if ( h != nullptr )    {
+      size_t siz = h->serialize(buffer_ptr);
+      check_serial_buffers(ptr, total_size, len += siz, h);
+      buffer_ptr = add_ptr(buffer_ptr, siz);
+      if (clear) h->clear();
     }
     else    {
-      DimBuffBase hh;
-      hh.type = (unsigned int)H_ILLEGAL;
-      ::memcpy (pp,&hh,sizeof(hh));
-      pp = AddPtr(pp,sizeof(DimBuffBase));
+      DimBuffBase b;
+      b.type = (unsigned int)H_ILLEGAL;
+      ::memcpy (buffer_ptr, &b, sizeof(b));
+      buffer_ptr = add_ptr(buffer_ptr, sizeof(b));
+      len += sizeof(DimBuffBase);
     }
   }
-  return ptr;
+  return std::make_pair(total_size,ptr);
 }
 
-void *ObjSerializer::SerializeObj(char *name, void *&ptr, size_t& siz, bool clear)
-{
-  MonBase *h = this->findobj(name);
-  if ( h == 0 )  {
-    ptr = Allocate(siz);
-    return ptr;
+std::pair<size_t,void*> ObjSerializer::serialize_obj(const std::vector<std::string>& nams, size_t offset, bool clear)   {
+  size_t total_size = offset;
+  std::vector<MonBase*> items;
+
+  items.reserve(nams.size());
+  for (const auto& name : nams )  {
+    auto* h = this->find(name);
+    if ( h == nullptr )  {
+      total_size += sizeof(DimBuffBase);
+      items.emplace_back(nullptr);
+      continue;
+    }
+    total_size += h->xmitbuffersize();
+    items.emplace_back(h);
   }
-  size_t bs = siz + h->xmitbuffersize();
-  ptr = Allocate(bs);
-  void* pp = AddPtr(ptr, siz);
-  siz = bs;
-  h->Serialize(pp);
-  if (clear)  {
-    h->clear();
+  void*  ptr        = this->buffer.allocate(total_size);
+  void*  buffer_ptr = add_ptr(ptr,offset);
+  size_t len = 0;
+  for ( auto* h : items )   {
+    if ( h != nullptr )    {
+      size_t siz = h->serialize(buffer_ptr);
+      check_serial_buffers(ptr, total_size, len += siz, h);
+      buffer_ptr = add_ptr(buffer_ptr, siz);
+      if (clear) h->clear();
+    }
+    else    {
+      DimBuffBase b;
+      b.type = (unsigned int)H_ILLEGAL;
+      ::memcpy (buffer_ptr, &b, sizeof(b));
+      buffer_ptr = add_ptr(buffer_ptr, sizeof(b));
+      len += sizeof(DimBuffBase);
+    }
   }
-  return ptr;
+  return std::make_pair(total_size,ptr);
 }
 
-void *ObjSerializer::SerializeDir(void *&ptr, size_t& siz)   {
-  size_t bs = siz;
-  for (const auto& i : *m_objmap )
-    bs += i.second->name_length()+sizeof(int);
-
-  ptr = Allocate(bs);
-  void* pp = ptr;
-  pp = AddPtr(pp,siz);
-  siz = bs;
-  for (const auto& i : *m_objmap )  {
-    MonBase *h = (MonBase *)i.second;
-    *(int*)pp = h->type;
-    pp = AddPtr(pp,sizeof(int));
-    pp = h->cpyName(pp);
-    *(char*)pp = 0;
-    pp=AddPtr(pp,1);
+std::pair<size_t,void*> ObjSerializer::serialize_dir(size_t offset)   {
+  size_t total_size = offset;
+  auto objects = this->collect();
+  for (const auto* h : objects )
+    total_size += h->name_length() + sizeof(int);
+
+  void*      ptr = this->buffer.allocate(total_size);
+  DimDirEnt* ent = add_ptr<DimDirEnt>(ptr, offset);
+  for (const auto* h : objects )  {
+    ent->type = h->type;
+    ::strncpy(ent->name,h->name.c_str(),h->name.length()+1);
+    ent = add_ptr<DimDirEnt>(ent,sizeof(ent->type)+h->name.length()+1);
   }
-  return ptr;
+  return std::make_pair(total_size,ptr);
 }
 
-void *ObjSerializer::Allocate(size_t siz)  {
-  if (buffersize < siz)  {
-    if ( buffer ) ::free(buffer);
-    buffer = ::malloc(siz);
-    buffersize = siz;
+void ObjSerializer::updateExpansions()   {
+  if ( this->expand )    {
+    if ( monitorClass )    {
+      for ( auto& j : monitorClass->entities )
+	j.second->update_OutputService();
+    }
+    if ( manager )   {
+      for( auto& i : this->manager->getMap() )   {
+	for ( auto& j : i.second->entities )
+	  j.second->update_OutputService();
+      }
+    }
   }
-  return buffer;
-}
-
-void ObjSerializer::DeSerializeObj(char *,void *&)
-{
-}
-
-void ObjSerializer::DeSerializeObj(std::vector<std::string> &,void *&)
-{
 }
 
-void ObjSerializer::updateExpansions(void)  {
-  if ( this->expand )  {
-    for (const auto& i : *m_objmap )
-      i.second->update_OutputService();
-  }
+std::pair<size_t,const void*> ObjSerializer::data()   const     {
+  return std::make_pair(this->buffer.used(), this->buffer.begin());
 }
 
-
-
diff --git a/Online/GauchoBase/src/ObjService.cpp b/Online/GauchoBase/src/ObjService.cpp
index e0d24174c5cbf7ee161ab4ea38f1d5c63a4fafc2..571ddabfc7a5a44fd0b24b15c62125c24999dea5 100644
--- a/Online/GauchoBase/src/ObjService.cpp
+++ b/Online/GauchoBase/src/ObjService.cpp
@@ -9,66 +9,78 @@
 // Author     : B.Jost
 //
 //==========================================================================
-#include <Gaucho/ObjSerializer.h>
 #include <Gaucho/ObjService.h>
+#include <Gaucho/MonBase.h>
 #include <Gaucho/MonSys.h>
+#include <RTL/strdef.h>
+#include <RTL/rtl.h>
 
 #include <vector>
 
 using namespace Online;
 
-ObjService::ObjService (DimServerDns *dns,ObjSerializer *s, const std::string& name, const char *format, void *buff, size_t siz)
-  : DimService(dns, name.c_str(), format, buff, siz), serializer(s)
+ObjService::ObjService (std::shared_ptr<DimServerDns>& dns, std::unique_ptr<Serializer>&& s, const std::string& name, const char *format, void *buff, size_t siz)
+  : DimService(dns.get(), name.c_str(), format, buff, siz), serializer(std::move(s))
 {
+  add_updater(dns.get());
 }
 
-ObjService::ObjService (ObjSerializer *s, const std::string& name, const char *format, void *buff, size_t siz)
-  : DimService(name.c_str(), format, buff, siz), serializer(s)
+ObjService::ObjService (std::unique_ptr<Serializer>&& s, const std::string& name, const char *format, void *buff, size_t siz)
+  : DimService(name.c_str(), format, buff, siz), serializer(std::move(s))
 {
+  add_updater();
 }
 
-ObjService::ObjService (DimServerDns *dns,ObjSerializer *s, const std::string& name, const char *format, void *buff, size_t siz, void **extbuff, size_t *extbuffs)
-  : DimService(dns,name.c_str(), format, buff, siz), serializer(s)
+ObjService::ObjService (std::shared_ptr<DimServerDns>& dns, std::unique_ptr<Serializer>&& s, const std::string& name, const char *format, void *buff, size_t siz, std::shared_ptr<mem_buff> extbuff)
+  : DimService(dns.get(), name.c_str(), format, buff, siz), serializer(std::move(s)), extBuffer(extbuff)
 {
-  m_extBuffer  = true;
-  m_buffer     = extbuff;
-  m_buffersize = extbuffs;
+  add_updater(dns.get());
 }
 
-
-ObjService::ObjService (ObjSerializer *s, const std::string& name, const char *format, void *buff, size_t siz, void **extbuff, size_t *extbuffs)
-  : DimService(name.c_str(), format, buff, siz), serializer(s)
+ObjService::ObjService (std::unique_ptr<Serializer>&& s, const std::string& name, const char *format, void *buff, size_t siz, std::shared_ptr<mem_buff> extbuff)
+  : DimService(name.c_str(), format, buff, siz), serializer(std::move(s)), extBuffer(extbuff)
 {
-  m_extBuffer  = true;
-  m_buffer     = extbuff;
-  m_buffersize = extbuffs;
+  add_updater();
 }
 
-void ObjService::Serialize(int updtIntv)
-{
-  if ( !m_extBuffer )  {
-    void *pp = nullptr;
-    size_t bs = m_hdr.SizeOf();
-    m_serptr = this->serializer->SerializeObj(pp, bs);
-    m_hdr.m_magic = SERIAL_MAGIC;
-    m_hdr.buffersize = bs-m_hdr.SizeOf();
-    m_hdr.updateInterval = updtIntv;
-    ::memcpy(m_serptr,&m_hdr,m_hdr.SizeOf());
-    m_sersiz = bs;
-  }
-  else  {
-    m_serptr = *m_buffer;
-    m_sersiz = *m_buffersize;
+void ObjService::add_updater(DimServerDns* dns)    {
+  std::string nn = RTL::str_replace(this->getName(),"/","_");
+  if ( dns )
+    this->num_update_svc.reset(new DimService(dns, ("Updates/"+nn).c_str(),"I", &this->num_updates, sizeof(this->num_updates)));
+  else
+    this->num_update_svc.reset(new DimService(("Updates/"+nn).c_str(),"I", &this->num_updates, sizeof(this->num_updates)));
+}
+
+const void* ObjService::serialized_buffer()   const   {
+  return this->extBuffer ? this->m_serptr : this->serializer->data().second;
+}
+
+size_t ObjService::serialized_size()   const   {
+  return this->extBuffer ? this->m_sersiz : this->serializer->data().first;
+}
+
+void ObjService::serialize(int updtIntv)   {
+  if ( this->extBuffer )  {
+    this->m_serptr = this->extBuffer->begin();
+    this->m_sersiz = this->extBuffer->used();
+    return;
   }
+  auto [len, ptr] = this->serializer->serialize_obj(m_hdr.SizeOf());
+  this->m_serptr = ptr;
+  this->m_sersiz = len;
+  this->m_hdr.m_magic = SERIAL_MAGIC;
+  this->m_hdr.buffersize = len - m_hdr.SizeOf();
+  this->m_hdr.updateInterval = updtIntv;
+  ::memcpy(this->m_serptr,&m_hdr,m_hdr.SizeOf());
 }
 
-void ObjService::Update()
-{
-  updateService(this->m_serptr,this->m_sersiz);
-  if (this->expand) this->serializer->updateExpansions();
+void ObjService::update()  {
+  ++this->num_updates;
+  this->updateService(this->m_serptr,this->m_sersiz);
+  this->serializer->updateExpansions();
+  this->num_update_svc->updateService();
 }
 
-void ObjService::setEORflag(bool val)
-{
+void ObjService::setEORflag(bool val)   {
   m_EORservice = val;
 }
diff --git a/Online/GauchoBase/src/RPCRec.cpp b/Online/GauchoBase/src/RPCRec.cpp
index a52ffa1594611076cc2dc9701e6c7940064186eb..ee8514bd7194a2e4192934d99f6c5cc89ac1a0cf 100644
--- a/Online/GauchoBase/src/RPCRec.cpp
+++ b/Online/GauchoBase/src/RPCRec.cpp
@@ -29,29 +29,20 @@ int RPCRec::analyseReply()   {
   m_reply = RPCCIllegal;
 
   if (rep->status == -1)
-  {
-    //    printf ("Timeout...\n");
     return 1;
-  }
   if (rep->status == -2)
-  {
-    //    printf ("RPC Error...\n");
     return 2;
-  }
+
   m_reply = rep->comm;
-  switch (rep->comm)
-  {
+  switch (rep->comm)  {
     case RPCCIllegal:
-    {
       return 3;
-    }
     case RPCCRead:
     case RPCCReadAll:
     case RPCCClear:
     case RPCCClearAll:
     {
       valend = (void*)((char *)valin+siz);
-//      printf("Received answer of size %d\n",siz);
       DimHistbuff1 *p1;
       hists.clear();
       p1 = (DimHistbuff1*)(AddPtr(valin,sizeof(RPCReply)));
@@ -69,16 +60,12 @@ int RPCRec::analyseReply()   {
         }
         nam = (char*)AddPtr(p1,namoff);
         hists.insert(std::pair<char*,void*> (nam,p1));
-  //          printf ("Type %d record Length %d dimension %d hdrlength %d\n title %s\n",
-  //            p1->type,p1->reclen,p1->dim,p1->dataoff,(char*)((char*)p1+titoff));
         if (p1->reclen<= 0) break;
         p1 = (DimHistbuff1*)((char*)p1+p1->reclen);
       }
       break;
     }
-    case RPCCDirectory:
-    {
-//      printf("Received answer of size %d\n",siz);
+    case RPCCDirectory:    {
       void *p1 = (AddPtr(valin,sizeof(RPCReply)));
       int recl;
       int cumul=sizeof(RPCReply);
@@ -98,75 +85,53 @@ int RPCRec::analyseReply()   {
       break;
     }
   }
-//    cout << "Callback RPC Received : " << valin << endl;
   return 0;
 }
-int RPCRec::analyseReply(NAMEVEC& v)
-{
+
+int RPCRec::analyseReply(NAMEVEC& v)   {
   int stat = analyseReply();
   if (stat == 0)
-  {
     v = names;
-  }
   return stat;
 }
-int RPCRec::analyseReply(PTRMAP& p)
-{
+
+int RPCRec::analyseReply(PTRMAP& p)   {
   int stat = analyseReply();
   if (stat == 0)
-  {
     p = hists;
-  }
   return stat;
 
 }
-int RPCRec::analyseReply(STRVEC& v)
-{
+int RPCRec::analyseReply(STRVEC& v)   {
   int stat = analyseReply();
   v.clear();
-  if (stat == 0)
-  {
+  if (stat == 0)  {
     for (auto i=names.begin();i!=names.end();i++)
       v.push_back(*i);
   }
   return stat;
-//      printf("Total Number of Histograms: %d\n",n_hist);
-
 }
 
-void RPCRec::rpcInfoHandler()
-{
+void RPCRec::rpcInfoHandler()    {
   if (m_synch) return;
   int stat = analyseReply();
   if (stat != 0) return;
-  switch (m_reply)
-  {
+  switch (m_reply)  {
     case RPCCIllegal:
-    {
       return;
-    }
     case RPCCRead:
     case RPCCReadAll:
     case RPCCClear:
     case RPCCClearAll:
-    {
       if (DatCB != 0)
-      {
         DatCB(hists);
-      }
       break;
-    }
     case RPCCDirectory:
-    {
       if (DirCB != 0)
-      {
         DirCB(names);
-      }
       break;
-    }
-  }
-  return;
   }
+}
 
 RPCRec::RPCRec(const char *name, int timeout, bool synch) : DimRpcInfo(name, timeout, -1)
 {
@@ -174,6 +139,3 @@ RPCRec::RPCRec(const char *name, int timeout, bool synch) : DimRpcInfo(name, tim
   DatCB = 0;
   m_synch = synch;
 }
-RPCRec::~RPCRec()
-{
-}
diff --git a/Online/GauchoBase/src/RateMgr.cpp b/Online/GauchoBase/src/RateMgr.cpp
index e38bf53c6f1277dbbd3e642f5185a512303a9a52..a6109eb9df33c3a528d75997112ff8b74853a8f5 100644
--- a/Online/GauchoBase/src/RateMgr.cpp
+++ b/Online/GauchoBase/src/RateMgr.cpp
@@ -9,41 +9,46 @@
 // Author     : B.Jost
 //
 //==========================================================================
-#include "Gaucho/RateMgr.h"
 
-using namespace Online;
+#include "Gaucho/RateMgr.h"
+#include "Gaucho/MonRate.h"
+#include "Gaucho/MonitorClass.h"
 
-RateMgr::RateMgr(const std::string& , int ) : m_deltaT(0)
-{
+namespace {
+  bool is_rate(MONTYPE typ)   {
+    switch(typ)   {
+    case C_RATEFLOAT:
+    case C_RATEDOUBLE:
+    case C_RATEDOUBLESTAR:
+      return true;
+    default:
+      return false;
+    }
+  }
 }
 
-RateMgr::~RateMgr()
+Online::RateMgr::RateMgr(MonitorClass* cl)
+  : monClass(cl)
 {
 }
 
-void RateMgr::makeRates(unsigned long dt)
-{
-  for ( const auto& o : m_rateMap )
-    o.second->makeRate(dt);
+void Online::RateMgr::makeRates(unsigned long dt)   {
+  for ( auto& o : this->monClass->entities )    {
+    if ( is_rate(o.second->type) ) 
+      ((MonRateBase*)o.second.get())->makeRate(dt);
+  }
 }
 
-void RateMgr::zero()
-{
-  for ( const auto& o : m_rateMap )
-    o.second->zero();
+void Online::RateMgr::zero()   {
+  for ( auto& o : this->monClass->entities )    {
+    if ( is_rate(o.second->type) ) 
+      ((MonRateBase*)o.second.get())->zero();
+  }
 }
 
-void RateMgr::CreateOutputServices(std::string infix)
-{
-  for ( const auto& o : m_rateMap )
-    o.second->create_OutputService(infix);
-}
-
-void RateMgr::print()
-{
-//  for (Rateit rateMapIt = m_rateMap.begin();rateMapIt != m_rateMap.end();rateMapIt++)
-//  {
-//    MonRateBase *i = rateMapIt->second;
-//    i->print();
-//  }
+void Online::RateMgr::CreateOutputServices(const std::string& infix)    {
+  for ( auto& o : this->monClass->entities )    {
+    if ( is_rate(o.second->type) ) 
+      ((MonRateBase*)o.second.get())->create_OutputService(infix);
+  }
 }
diff --git a/Online/GauchoBase/src/TaskSaveTimer.cpp b/Online/GauchoBase/src/TaskSaveTimer.cpp
index ad47d8a0471ff4fd2463b627ce38bcef81f39d09..cc187633c0b66fd137578bb26ec231ed735d9077 100644
--- a/Online/GauchoBase/src/TaskSaveTimer.cpp
+++ b/Online/GauchoBase/src/TaskSaveTimer.cpp
@@ -18,6 +18,8 @@
 #include <Gaucho/dimhist.h>
 #include <Gaucho/MonitorClass.h>
 #include <Gaucho/HistSerDes.h>
+#include <Gaucho/ObjService.h>
+#include <RTL/strdef.h>
 
 #include <cstdio>
 #include <memory>
@@ -28,10 +30,9 @@
 
 using namespace Online;
 
-TaskSaveTimer::TaskSaveTimer(MonSubSys *add, int period)
-  : GenTimer((void*) add, period * 1000, TIMER_TYPE_PERIODIC)
+TaskSaveTimer::TaskSaveTimer(std::shared_ptr<MonSubSys> add, int period)
+  : GenTimer(add.get(), period * 1000, TIMER_TYPE_PERIODIC), m_subsys(move(add))
 {
-  m_subsys = add;
   m_dueTime = 0;
   TH1D::SetDefaultSumw2();
   TH2D::SetDefaultSumw2();
@@ -39,9 +40,11 @@ TaskSaveTimer::TaskSaveTimer(MonSubSys *add, int period)
   m_dontdimlock = true;
 }
 
+TaskSaveTimer::~TaskSaveTimer()  {
+}
+
 void TaskSaveTimer::timerHandler(void)   {
-  if ( m_subsys )
-  {
+  if ( m_subsys )   {
     // Need protection against m_subsys==0:
     // If the save time runs, but no histograms were
     // ever published, m_subsys (histograms) is NULL!
@@ -49,30 +52,28 @@ void TaskSaveTimer::timerHandler(void)   {
     if (!m_dontdimlock)
       dim_lock();
     makeDirs(m_subsys->runNumber);
-    openFile();
+    auto file = openFile();
     if (!m_dontdimlock)
       dim_unlock();
     m_subsys->unlock();
     for (const auto& i : m_subsys->classMgr.getMap() )   {
-      int siz = i.second->m_genSrv->serializer->buffersize;
+      int siz = i.second->genSrv->serialized_size();
       if ( m_bsiz < siz )   {
 	m_buffer.reset(new unsigned char[m_bsiz = siz]);
       }
-      ::memcpy(m_buffer.get(),i.second->m_genSrv->serializer->buffer,siz);
+      ::memcpy(m_buffer.get(),i.second->genSrv->serialized_buffer(),siz);
       this->savetoFile(m_buffer.get());
     }
-    this->closeFile();
+    this->closeFile(std::move(file));
     m_subsys->clear();
   }
 }
 
-void TaskSaveTimer::stop()
-{
+void TaskSaveTimer::stop()   {
   this->GenTimer::stop();
 }
 
-void TaskSaveTimer::makeDirs(int runo)
-{
+void TaskSaveTimer::makeDirs(int runo)  {
   char fdir[1024];
   char fn[2048];
   char _root[256] = "";
@@ -128,20 +129,23 @@ void TaskSaveTimer::makeDirs(int runo)
   m_currFileName = fn;
 }
 
-void TaskSaveTimer::openFile()   {
-  m_currFile.reset(TFile::Open(m_currFileName.c_str(), "RECREATE"));
-  if ( !m_currFile || m_currFile->IsZombie())    {
+std::unique_ptr<TFile> TaskSaveTimer::openFile()   {
+  std::unique_ptr<TFile> file(TFile::Open(m_currFileName.c_str(), "RECREATE"));
+  if ( !file || file->IsZombie())    {
     ::printf("Root File %s cannot be opened or is Zombie\n", m_currFileName.c_str());
     ::fflush(stdout);
+    file.reset();
   }
+  return file;
 }
 
-void TaskSaveTimer::closeFile()   {
-  locked_execution(m_subsys, [this]() {
-      m_currFile->Close();
-      m_currFile.reset();
+void TaskSaveTimer::closeFile(std::unique_ptr<TFile>&& file)   {
+  auto* f = file.release();
+  locked_execution(m_subsys.get(), [f]() {
+      if ( f ) f->Close();
+      delete f;
     });
-  if (m_filenamesvc != 0)  {
+  if ( m_filenamesvc )  {
     m_filenamesvc->updateService((char*)m_currFileName.c_str());
   }
 }
@@ -173,17 +177,17 @@ void TaskSaveTimer::savetoFile(void *buffer)   {
         m_subsys->lock();
         TH1* r = (TH1*)HistSerDes::de_serialize(buff);
         m_subsys->unlock();
-	std::unique_ptr<dyn_string> hname(Strsplit(r->GetName(), "/"));
+	auto hname = RTL::str_split(r->GetName(), "/");
         m_subsys->lock();
         gDirectory->Cd("/");
-        for (const auto& dir : *hname )  {
+        for (const auto& dir : hname )  {
           TKey *k = gDirectory->GetKey(dir.c_str());
           if (k == 0)   {
             gDirectory->mkdir(dir.c_str());
           }
           gDirectory->Cd(dir.c_str());
         }
-	const auto& last = hname->at(hname->size() - 1);
+	const auto& last = hname.at(hname.size() - 1);
         r->SetName(last.c_str());
         m_subsys->unlock();
         switch (b->type)   {
@@ -193,10 +197,10 @@ void TaskSaveTimer::savetoFile(void *buffer)   {
           case H_PROFILE:
           case H_2DPROFILE:
           case H_RATE:
-	    locked_execution(m_subsys, [r,last]() {  r->Write(last.c_str()); });
+	    locked_execution(m_subsys.get(), [r,last]() {  r->Write(last.c_str()); });
             break;
         }
-	locked_execution(m_subsys, [r]() {  if ( r ) delete r; });
+	locked_execution(m_subsys.get(), [r]() {  if ( r ) delete r; });
         buff = add_ptr(buff, b->reclen);
         continue;
       }
@@ -211,6 +215,6 @@ void TaskSaveTimer::savetoFile(void *buffer)   {
       }
     }
   }
-  locked_execution(m_subsys, [dirstat]() {  TH1::AddDirectory(dirstat); });
+  locked_execution(m_subsys.get(), [dirstat]() {  TH1::AddDirectory(dirstat); });
 }
 
diff --git a/Online/GauchoBase/src/Utilities.cpp b/Online/GauchoBase/src/Utilities.cpp
index e45db6b7dbba88c8511b82a7a452b98e5ac5c4ab..f49957543cea5219af064346b20a5f710984c21a 100644
--- a/Online/GauchoBase/src/Utilities.cpp
+++ b/Online/GauchoBase/src/Utilities.cpp
@@ -19,7 +19,7 @@
 #include <RTL/strdef.h>
 
 dyn_string *Strsplit(const char *s, const char *del)  {
-  return new dyn_string(std::move(RTL::str_split(s, del)));
+  return new dyn_string(RTL::str_split(s, del));
 }
 
 void StringReplace(std::string &in, const std::string& patt, const std::string &repl)   {
diff --git a/Online/IPMI/src/NewLib/LANPlus.cpp b/Online/IPMI/src/NewLib/LANPlus.cpp
index 1d424cf2d5fd93de6ae0d5c15105659cdf24fe09..8df6b3eab6cda4fe54f8f9fefe53ba9f6e65ea6c 100644
--- a/Online/IPMI/src/NewLib/LANPlus.cpp
+++ b/Online/IPMI/src/NewLib/LANPlus.cpp
@@ -167,9 +167,11 @@ int LANPlus::lanplus_get_requested_ciphers(int       cipher_suite_id,
  */
 LANPlus::~LANPlus()
 {
-  if (Crypt != 0) {delete Crypt;Crypt=0;};
-  if (oemO != 0) {delete oemO;oemO=0;};
-  if (auth != 0) {delete auth;auth=0;};
+  if (auth != 0){ delete auth;auth=0;}
+  if (ipmi_req_entries !=0) {delete ipmi_req_entries;ipmi_req_entries = 0;}
+  if (ipmi_req_entries_tail !=0) {delete ipmi_req_entries_tail;ipmi_req_entries_tail = 0;}
+  if (oemO !=0) {delete oemO;oemO=0;}
+  if (Crypt != 0) {delete Crypt;Crypt=0;}
 }
 void LANPlus::lanplus_swap(
                   uint8_t * buffer,
diff --git a/Online/IPMI/src/NewLib/LANPlus.h b/Online/IPMI/src/NewLib/LANPlus.h
index c76449d92bd465d1cd1437e1162b0dc0340ab332..7e52e2c65b575ef5031fe05ce42bfeb84bfb77a8 100644
--- a/Online/IPMI/src/NewLib/LANPlus.h
+++ b/Online/IPMI/src/NewLib/LANPlus.h
@@ -168,9 +168,9 @@ class LANPlus
     char name[16];//: "lan"
     char desc[128];//("IPMI v1.5 LAN Interface");
     uint8_t bridge_possible;
-    ipmi_auth<LANPlus> *auth;
+    ipmi_auth<LANPlus> *auth=0;
     int sessionsup_fail;
-    ipmi_oem<LANPlus> *oemO;
+    ipmi_oem<LANPlus> *oemO=0;
     struct ipmi_rs rsp;
     LANPlus(ipmi_Intf *Intf)
     {
@@ -186,7 +186,7 @@ class LANPlus
       Crypt = new LANPlusCrypt<LANPlus>(oemO);
     }
     ~LANPlus();
-    LANPlusCrypt<LANPlus> *Crypt;
+    LANPlusCrypt<LANPlus> *Crypt=0;
     int ipmi_send_packet( uint8_t * data, int data_len);
     int ipmi_open();
     int ipmi_setup();
diff --git a/Online/IPMI/src/NewLib/asf.h b/Online/IPMI/src/NewLib/asf.h
index b223f685c00d222c7b9fc0895e1698e5e9329d5f..431e9a2e6178f4648ffd0ed3044343f05f1973e5 100644
--- a/Online/IPMI/src/NewLib/asf.h
+++ b/Online/IPMI/src/NewLib/asf.h
@@ -45,6 +45,7 @@
 #define IPMI_ASF_H
 
 #include "helper.h"
+//#include "lan.h"
 
 #define ASF_RMCP_IANA		0x000011be
 
@@ -67,7 +68,7 @@ static const struct valstr asf_type_vals[] __attribute__((unused)) = {
 
 /* ASF message header */
 #ifdef HAVE_PRAGMA_PACK
-#pragma pack(push,1)
+#pragma pack(1)
 #endif
 struct asf_hdr {
   uint32_t	iana;
@@ -77,7 +78,7 @@ struct asf_hdr {
   uint8_t		len;
 } /*ATTRIBUTE_PACKING*/;
 #ifdef HAVE_PRAGMA_PACK
-#pragma pack(pop)
+#pragma pack(0)
 #endif
 
 template <class T>int handle_asf( ipmi_intf<T> * intf, uint8_t * data, int data_len);
diff --git a/Online/IPMI/src/NewLib/helper.h b/Online/IPMI/src/NewLib/helper.h
index 42432203de178a5e24bd2b87a12a61c8edca0e22..0157a69614d2fc4c6c853d80395d13a2fa0f4c5f 100644
--- a/Online/IPMI/src/NewLib/helper.h
+++ b/Online/IPMI/src/NewLib/helper.h
@@ -73,9 +73,8 @@
 //template <class ipmi_intf> ;//class ipmi_intf;
 #define IPM_DEV_MANUFACTURER_ID(x) \
     ((uint32_t) ((x[2] & 0x0F) << 16 | x[1] << 8 | x[0]))
-
 #ifdef HAVE_PRAGMA_PACK
-#pragma pack(push,1)
+#pragma pack(1)
 #endif
 struct ipm_devid_rsp
 {
@@ -89,10 +88,10 @@ struct ipm_devid_rsp
     uint8_t product_id[2];
     uint8_t aux_fw_rev[4];
 };
-
 #ifdef HAVE_PRAGMA_PACK
-#pragma pack(push,0)
+#pragma pack(0)
 #endif
+
 class valstr
 {
   public:
@@ -153,12 +152,6 @@ template <class T> class ipmi_helper
     uint16_t ipmi_get_oem_id(ipmi_intf<T> *intf);
     IPMI_OEM ipmi_get_oem(ipmi_intf<T> *intf);
 };
-
-#ifdef HAVE_PRAGMA_PACK
-#pragma pack(pop)
-#pragma pack(pop)
-#endif
-
 #define ipmi_open_file_read(file)	ipmi_open_file(file, 0)
 #define ipmi_open_file_write(file)	ipmi_open_file(file, 1)
 
diff --git a/Online/IPMI/src/NewLib/ipmi_channel.h b/Online/IPMI/src/NewLib/ipmi_channel.h
index 7d0471507ef2b14088d51d4577ed0e24fb30e9d6..79698012d357d79440ee9751aaca09dc8fa7087e 100755
--- a/Online/IPMI/src/NewLib/ipmi_channel.h
+++ b/Online/IPMI/src/NewLib/ipmi_channel.h
@@ -82,7 +82,7 @@ struct channel_access_t {
  * From table 22-15 of the IPMI v2.0 spec
  */
 #ifdef HAVE_PRAGMA_PACK
-#pragma pack(push,1)
+#pragma pack(1)
 #endif
 struct get_channel_auth_cap_rsp {
 	uint8_t channel_number;
@@ -125,9 +125,8 @@ struct get_channel_auth_cap_rsp {
 	uint8_t oem_aux_data; /* Additional OEM specific data for oem auths */
 } ATTRIBUTE_PACKING;
 #ifdef HAVE_PRAGMA_PACK
-#pragma pack(pop)
+#pragma pack(0)
 #endif
-
 template <class T> class ipmi_intf;
 template <class T> class ipmi_user;
 template <class T> class ipmi_channel
diff --git a/Online/IPMI/src/NewLib/ipmi_intf.h b/Online/IPMI/src/NewLib/ipmi_intf.h
index b083fcb629e388474c4decea805ee006e895cd23..71759a8a4bdac90086dbe57a3f9d59f9a360a981 100644
--- a/Online/IPMI/src/NewLib/ipmi_intf.h
+++ b/Online/IPMI/src/NewLib/ipmi_intf.h
@@ -174,7 +174,7 @@ template <class T> class ipmi_intf
   public:
 #include "newnew.h"
     class ipmi_cmd;
-    T *Lan;
+    T *Lan=0;
     struct ipmi_session_params ssn_params;
     char name[16];
     char desc[128];
@@ -185,8 +185,8 @@ template <class T> class ipmi_intf
     int noanswer=0;
     int picmg_avail=0;
     IPMI_OEM manufacturer_id=IPMI_OEM_UNKNOWN;
-    ipmi_chassis<T> *chassis;
-    ipmi_session<T> *session;
+    ipmi_chassis<T> *chassis=0;
+    ipmi_session<T> *session=0;
     ipmi_oem_handle<T> *oem=0;
     ipmi_helper <T> *helper=0;
     ipmi_cmd * cmdlist=0;
@@ -277,6 +277,7 @@ template <class T> class ipmi_intf
     //  ipmi_close_session_cmd(this);
       this->abort = 1;
       Lan->ipmi_close();
+      delete Lan;
       if (helper !=0) {delete helper;helper = 0;};
       if (oem !=0) {/*delete oem;*/oem = 0;};
 //      if (auth!=0) { /*delete auth;*/auth=0;};
diff --git a/Online/IPMI/src/NewLib/ipmi_session.h b/Online/IPMI/src/NewLib/ipmi_session.h
index 02c17137e4b436a1322611dad1f293a92d8d26c5..fb7bbb15aa4625f5987bc62115ffc7cf97edb99c 100644
--- a/Online/IPMI/src/NewLib/ipmi_session.h
+++ b/Online/IPMI/src/NewLib/ipmi_session.h
@@ -71,7 +71,7 @@ typedef enum
  * From table 22.25 of the IPMIv2 specification
  */
 #ifdef HAVE_PRAGMA_PACK
-#pragma pack(push,1)
+#pragma pack(1)
 #endif
 struct get_session_info_rsp
 {
@@ -148,7 +148,7 @@ struct get_session_info_rsp
     } channel_data;
 } /*ATTRIBUTE_PACKING*/;
 #ifdef HAVE_PRAGMA_PACK
-#pragma pack(pop)
+#pragma pack(0)
 #endif
 #define IPMI_AUTHSTATUS_PER_MSG_DISABLED    0x10
 #define IPMI_AUTHSTATUS_PER_USER_DISABLED   0x08
diff --git a/Online/IPMI/src/NewLib/lan.cpp b/Online/IPMI/src/NewLib/lan.cpp
index c4e7fb0a17b21c3999af71a4863cc9d02f980bd4..6249cd995693ed5db0ef28e9ca3164fda9490787 100644
--- a/Online/IPMI/src/NewLib/lan.cpp
+++ b/Online/IPMI/src/NewLib/lan.cpp
@@ -103,6 +103,10 @@ extern const struct valstr ipmi_authtype_session_vals[];
 lan::~lan()
 {
   if (auth != 0){ delete auth;auth=0;}
+  if (ipmi_req_entries !=0) {delete ipmi_req_entries;ipmi_req_entries = 0;}
+  if (ipmi_req_entries_tail !=0) {delete ipmi_req_entries_tail;ipmi_req_entries_tail = 0;}
+  if (oemO !=0) {delete oemO;oemO=0;}
+  if (Crypt != 0) {delete Crypt;Crypt=0;}
 }
 ipmi_rq_entry<lan> *lan::ipmi_req_add_entry(ipmi_rq * req, uint8_t req_seq)
 {
diff --git a/Online/IPMI/src/NewLib/lan.h b/Online/IPMI/src/NewLib/lan.h
index e78d7bc5eeb21a1ca37ef4d6fbf3775472c81bf8..b8d3d411fd336d562386f99b9b40f688cc340c42 100644
--- a/Online/IPMI/src/NewLib/lan.h
+++ b/Online/IPMI/src/NewLib/lan.h
@@ -45,12 +45,12 @@ class lan
 #include "newnew.h"
     ipmi_rq_entry<lan> * ipmi_req_entries;
     ipmi_rq_entry<lan> * ipmi_req_entries_tail;
-    ipmi_oem<lan> *oemO;
+    ipmi_oem<lan> *oemO=0;
     ipmi_intf<lan> *intf;
     uint8_t bridge_possible;
     char name[16];//: "lan"
     char desc[128];//("IPMI v1.5 LAN Interface");
-    LANPlusCrypt<lan> *Crypt;
+    LANPlusCrypt<lan> *Crypt=0;
     lan(ipmi_intf<lan> *Intf)
     {
       this->intf = Intf;
diff --git a/Online/IPMI/src/NewLib/newnew.h b/Online/IPMI/src/NewLib/newnew.h
index 62758ac8d77e57a6a4dc60d89f442b00908bb7e9..d3676f4f13c8846b15aac4eebaea05fb417e6808 100644
--- a/Online/IPMI/src/NewLib/newnew.h
+++ b/Online/IPMI/src/NewLib/newnew.h
@@ -15,8 +15,8 @@
  *  Created on: Feb 10, 2016
  *      Author: beat
  */
+//#include <string>
 #include "log.h"
-
 void *operator new(size_t s)
 {
   void *t = malloc(s);
@@ -27,10 +27,3 @@ void *operator new(size_t s)
   memset(t,0,s);
   return t;
 }
-
-void operator delete(void* pointer)
-{
-  if ( pointer )   {
-    ::free(pointer);
-  }
-}
diff --git a/Online/IPMI/src/NewLib/rmcp.h b/Online/IPMI/src/NewLib/rmcp.h
index 3c5993b7f9726b25cad097c4f3bec064c25ade15..533536d6c2b3d3bc04d64420a52d70f4efc7c8a5 100644
--- a/Online/IPMI/src/NewLib/rmcp.h
+++ b/Online/IPMI/src/NewLib/rmcp.h
@@ -45,6 +45,7 @@
 #define IPMI_RMCP_H
 
 #include "helper.h"
+//#include "lan.h"
 #include "asf.h"
 
 #define RMCP_VERSION_1		0x06
@@ -75,7 +76,7 @@ static const struct valstr rmcp_class_vals[] __attribute__((unused)) = {
 };
 
 #ifdef HAVE_PRAGMA_PACK
-#pragma pack(push,1)
+#pragma pack(1)
 #endif
 /* RMCP message header */
 struct rmcp_hdr {
@@ -85,11 +86,11 @@ struct rmcp_hdr {
   uint8_t Class;
 } /*ATTRIBUTE_PACKING*/;
 #ifdef HAVE_PRAGMA_PACK
-#pragma pack(pop)
+#pragma pack(0)
 #endif
 
 #ifdef HAVE_PRAGMA_PACK
-#pragma pack(push,1)
+#pragma pack(1)
 #endif
 struct rmcp_pong {
   struct rmcp_hdr rmcp;
@@ -101,7 +102,7 @@ struct rmcp_pong {
   uint8_t reserved[6];
 } /*ATTRIBUTE_PACKING*/;
 #ifdef HAVE_PRAGMA_PACK
-#pragma pack(pop)
+#pragma pack(0)
 #endif
 
 template <class T>int handle_rmcp( ipmi_intf<T> * intf, uint8_t * data, int data_len);
diff --git a/Online/dim/src/util/dim_get_services.cxx b/Online/dim/src/util/dim_get_services.cxx
index a3132e0dda12a2f0c3b85589d2a1bf729602881b..a0a037204cca520d2f2e3fe2e6f4efb19aaa6c4a 100755
--- a/Online/dim/src/util/dim_get_services.cxx
+++ b/Online/dim/src/util/dim_get_services.cxx
@@ -35,6 +35,8 @@ void rout(void *vtag, void *vbuffer, int *size)
     if ((*size == 4) && (*buffer == no_link))
     {
       printf("Service %s Not Available\n", str);
+      received =1;
+      return;
     }
     else
     {
@@ -46,6 +48,12 @@ void rout(void *vtag, void *vbuffer, int *size)
       }
     }
   }
+  if ((*size == 4) && (*buffer == no_link))
+  {
+    printf("Service %s Not Available\n", str);
+    received =1;
+    return;
+  }
   if (strcmp(format,"C")== 0)
   {
     Agg=Agg+std::string((char*)vbuffer);