Index: src/UIElements/Qt4/InstanceBoard/ObservedValuesContainer.hpp
===================================================================
--- src/UIElements/Qt4/InstanceBoard/ObservedValuesContainer.hpp	(revision 90821d3e29139e45d3df56d7c7f116d631c88f26)
+++ src/UIElements/Qt4/InstanceBoard/ObservedValuesContainer.hpp	(revision 68418ebdce3a77f78915901a8e48bd7cf1632f6c)
@@ -32,12 +32,20 @@
 class ObservedValuesContainer
 {
+public:
+
+  //!> typedef for callback functions to be used on last SubjectKilled()
+  typedef boost::function<void (const id _id)> onDestroy_t;
+
   /** Cstor of class ObservedValuesContainer.
    *
    * \param _name name used in debugging and prints
    * \param _board ref to InstanceBoard
+   * \param _onDestroy function to call when last subjectKilled() was received and
+   *        ObservedValues are destroyed
    */
   ObservedValuesContainer(
       const std::string _name,
-      QtObservedInstanceBoard &_board);
+      QtObservedInstanceBoard &_board,
+      const onDestroy_t _onDestroy);
 
   /** Delivers the set of Observed value for the instance identified by \a _id.
@@ -48,26 +56,30 @@
   typename T::ptr get(const id _id);
 
-  /** Returns an observed instance identified by \a _id, for deallocation.
+  /** Used by QtObserved.. instance to note that signOn() has been called.
    *
-   * \param _id identifier of the instance
+   * \param _id identifier of the instance who called signOn()
    */
-  void yield(const id _id);
+  void markObservedValuesAsConnected(const id _id);
 
-  ObservedValues_t getObservedValues(const id _id);
-
-  void returnObservedValues(const id _id, ObservedValues_t &_observedvalues);
+  /** Used by QtObserved.. instance to note that signOff() has been called.
+   *
+   * \param _id identifier of the instance who called signOff()
+   */
+  void markObservedValuesAsDisconnected(const id _id);
 
   /** Inform this container that subjectKilled() was received by one of the ObservedValues.
    *
    * \param _id identifier of the receiving instance
-   * \param _onDestroy function to call when last subjectKilled() was received and
-   *        ObservedValues are destroyed
    */
-  void countsubjectKilled(
-      const id _id,
-      boost::function<void (const id _id)> _onDestroy);
+  void countsubjectKilled(const id _id);
+
+  /** Erases a vector of observed values of an instance  identified by \a _id.
+   *
+   * \param _id identifier of instance
+   */
+  void removeObservedValues(const id _id);
 
 private:
-  typedef std::pair<ObservedValues_t, size_t> RefCountedObservedValues_t;
+  typedef std::pair<typename T::ptr, size_t> RefCountedObservedValues_t;
   typedef std::map<id, RefCountedObservedValues_t> CountedObservedValues_t;
   //!> internal vector of observed values
@@ -86,4 +98,24 @@
   QtObservedInstanceBoard &board;
 
+  //!> callback function when ObservedValues need to be destroyed
+  const onDestroy_t onDestroy;
+
+private:
+  /** Internal function to check whether an Observed instance identified by
+   * \a _id is still signOn() to its associated World instance.
+   *
+   * \param _id identifier of instance
+   * \return true - no more signOn()s, false - else
+   */
+  bool checkRefCount(const id _id) const;
+
+  /** Internal function to check whether any ObservedValue identified by
+   * \a _id is still signOn() to its associated World instance.
+   *
+   * \param _id identifier of instance
+   * \return true - no more signOn()s, false - else
+   */
+  bool checksubjectKilled(const id _id) const;
+
 private:
   //!> QtObservedInstanceBoard may access anything
@@ -96,5 +128,5 @@
    * \return true - insertion successful, false - else
    */
-  bool insert(const id _id, ObservedValues_t &_obsvalues);
+  bool insert(const id _id, const typename T::ptr &_obsvalues);
 
   /** Use to change the identifier associated with a vector of observed values.
@@ -113,11 +145,4 @@
   size_t getRefCount(const id _id) const;
 
-  /** Erases a vector of observed values of an instance  identified by \a _id.
-   *
-   * \param _id identifier of instance
-   * \return true - erase successful, false - else
-   */
-  bool erase(const id _id);
-
   /** Checks whether a vector of observed values of an instance  identified by \a _id
    * is present.
Index: src/UIElements/Qt4/InstanceBoard/ObservedValuesContainer_impl.hpp
===================================================================
--- src/UIElements/Qt4/InstanceBoard/ObservedValuesContainer_impl.hpp	(revision 90821d3e29139e45d3df56d7c7f116d631c88f26)
+++ src/UIElements/Qt4/InstanceBoard/ObservedValuesContainer_impl.hpp	(revision 68418ebdce3a77f78915901a8e48bd7cf1632f6c)
@@ -22,7 +22,9 @@
 ObservedValuesContainer<T,id>::ObservedValuesContainer(
     const std::string _name,
-    QtObservedInstanceBoard &_board) :
+    QtObservedInstanceBoard &_board,
+    const onDestroy_t _onDestroy) :
   NameOfType(_name),
-  board(_board)
+  board(_board),
+  onDestroy(_onDestroy)
 {}
 
@@ -34,63 +36,55 @@
       "ObservedValuesContainer::getObservedValues() - no observed values present for "
       +NameOfType+" "+toString(_id));
-  const ObservedValues_t &obsvalues = iter->second.first;
-  // increase refcount
-  ++(iter->second.second);
-  typename T::ptr _molecule(new T(obsvalues, board));
+  const typename T::ptr &obsvalues = iter->second.first;
 
-  return _molecule;
+  return obsvalues;
 }
 
 template <class T, typename id>
-void ObservedValuesContainer<T,id>::yield(const id _id)
+void ObservedValuesContainer<T,id>::markObservedValuesAsConnected(
+    const id _id)
 {
   typename CountedObservedValues_t::iterator iter = ObservedValues.find(_id);
-  ASSERT( iter != ObservedValues.end(),
-      "ObservedValuesContainer::returnObservedAtom() - no observed values present for "
-      +NameOfType+" "+toString(_id));
-  ASSERT( iter->second.second != 0,
-      "ObservedValuesContainer::returnObservedAtom() - all instances for "
-      +NameOfType+" "+toString(_id)+" have already been returned.");
-  // decrease refcount
-  --(iter->second.second);
-  if (iter->second.second == 0) {
-    // free instance
-  }
+  ASSERT (iter != ObservedValues.end(),
+      "ObservedValuesContainer<T,id>::markObservedValuesAsConnected() - Observed value of "
+      +NameOfType+" "+toString(_id)+" is not present yet.");
+  ++(iter->second.second);
 }
 
 template <class T, typename id>
-ObservedValues_t ObservedValuesContainer<T,id>::getObservedValues(const id _id)
+bool ObservedValuesContainer<T,id>::checkRefCount(
+    const id _id) const
 {
-  ObservedValues_t returnvalues;
-  typename CountedObservedValues_t::iterator iter = ObservedValues.find(_id);
-  ASSERT(iter != ObservedValues.end(),
-      "ObservedValuesContainer::getObservedValues() - "+NameOfType
-      +" values not present for id "+toString(_id));
-  if (iter->first == _id) {
-    returnvalues = iter->second.first;
-    ObservedValues.erase(iter);
-  }
-  return returnvalues;
+  typename CountedObservedValues_t::const_iterator iter = ObservedValues.find(_id);
+  return ((iter != ObservedValues.end()) && (iter->second.second == 0));
 }
 
 template <class T, typename id>
-void ObservedValuesContainer<T,id>::returnObservedValues(
-    const id _id,
-    ObservedValues_t &_observedvalues)
+void ObservedValuesContainer<T,id>::markObservedValuesAsDisconnected(
+    const id _id)
 {
-#ifndef NDEBUG
-  std::pair<typename CountedObservedValues_t::iterator, bool> inserter =
-#endif
-      ObservedValues.insert(
-          std::make_pair( _id, std::make_pair(_observedvalues,0) ) );
-  ASSERT( inserter.second,
-      "QtObservedInstanceBoard::returnAtomObservedValues() - could not insert ObservedValues for"
-      +toString(_id)+".");
+  typename CountedObservedValues_t::iterator iter = ObservedValues.find(_id);
+  ASSERT (iter != ObservedValues.end(),
+      "ObservedValuesContainer<T,id>::markObservedValuesAsDisconnected() - Observed value of "
+      +NameOfType+" "+toString(_id)+" is not present yet.");
+  ASSERT (iter->second.second != 0,
+      "ObservedValuesContainer<T,id>::markObservedValuesAsDisconnected() - Observed value of "
+      +NameOfType+" "+toString(_id)+" is already signOff() from all.");
+  --(iter->second.second);
+
+  if (checkRefCount(_id) && checksubjectKilled(_id))
+    removeObservedValues(_id);
 }
 
 template <class T, typename id>
-void ObservedValuesContainer<T,id>::countsubjectKilled(
-    const id _id,
-    boost::function<void (const id _id)> _onDestroy)
+bool ObservedValuesContainer<T,id>::checksubjectKilled(
+    const id _id) const
+{
+  typename subjectKilledCount_t::const_iterator iter = subjectKilledCount.find(_id);
+  return ((iter != subjectKilledCount.end()) && (iter->second == T::MAX_ObservedTypes));
+}
+
+template <class T, typename id>
+void ObservedValuesContainer<T,id>::countsubjectKilled(const id _id)
 {
   LOG(3, "DEBUG: ObservedValuesContainer got subjectKilled() for an observed value of "
@@ -102,21 +96,30 @@
     iter = inserter.first;
   }
+  ASSERT (iter->second < T::MAX_ObservedTypes,
+      "ObservedValuesContainer<T,id>::countsubjectKilled() - all subjectKilled() for "
+      +NameOfType+" "+toString(_id)+" for each observed channel came in already.");
   ++(iter->second);
 
-  if (iter->second > T::MAX_ObservedTypes) {
-    ASSERT( getRefCount(_id) == 0,
-        "ObservedValuesContainer::countsubjectKilled() - observed Values for "
-        +NameOfType+" "+toString(_id)+" are still being held somewhere.");
-    _onDestroy(_id);
-    subjectKilledCount.erase(iter);
-  }
+  if (checkRefCount(_id) && checksubjectKilled(_id))
+    removeObservedValues(_id);
 }
 
 template <class T, typename id>
-bool ObservedValuesContainer<T,id>::insert(const id _id, ObservedValues_t &_obsvalues)
+void ObservedValuesContainer<T,id>::removeObservedValues(const id _id)
+{
+  LOG(3, "DEBUG: ObservedValuesContainer removes " << NameOfType << " " << _id);
+  // call callback function
+  onDestroy(_id);
+  subjectKilledCount.erase(_id);
+  ObservedValues.erase(_id);
+}
+
+template <class T, typename id>
+bool ObservedValuesContainer<T,id>::insert(const id _id, const typename T::ptr &_obsvalues)
 {
   std::pair<typename CountedObservedValues_t::iterator, bool> inserter =
       ObservedValues.insert(
           std::make_pair( _id, std::make_pair(_obsvalues,0) ) );
+  _obsvalues->activateObserver();
   return inserter.second;
 }
@@ -156,15 +159,4 @@
 
 template <class T, typename id>
-bool ObservedValuesContainer<T,id>::erase(const id _id)
-{
-  typename CountedObservedValues_t::iterator iter = ObservedValues.find(_id);
-  if (iter != ObservedValues.end()) {
-    ObservedValues.erase(iter);
-    return true;
-  } else
-    return false;
-}
-
-template <class T, typename id>
 bool ObservedValuesContainer<T,id>::isPresent(const id _id) const
 {
Index: src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp
===================================================================
--- src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp	(revision 90821d3e29139e45d3df56d7c7f116d631c88f26)
+++ src/UIElements/Qt4/InstanceBoard/QtObservedAtom.cpp	(revision 68418ebdce3a77f78915901a8e48bd7cf1632f6c)
@@ -94,5 +94,5 @@
   ObservedValues(_ObservedValues)
 {
-  activateObserver();
+  // activating Observer is done by ObservedValueContainer when it's prepared
 }
 
@@ -173,5 +173,5 @@
     owner = NULL;
 
-    board.returnObservedAtom(getAtomIndex());
+    board.markObservedAtomAsDisconnected(getAtomIndex());
   }
 }
@@ -224,4 +224,5 @@
     owner = NULL;
     signedOffChannels = AllsignedOnChannels;
+    board.markObservedAtomAsDisconnected(getAtomIndex());
   }
 }
Index: src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.cpp
===================================================================
--- src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.cpp	(revision 90821d3e29139e45d3df56d7c7f116d631c88f26)
+++ src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.cpp	(revision 68418ebdce3a77f78915901a8e48bd7cf1632f6c)
@@ -40,4 +40,6 @@
 
 #include "CodePatterns/MemDebug.hpp"
+
+#include <boost/bind.hpp>
 
 #include "CodePatterns/Log.hpp"
@@ -54,27 +56,24 @@
   Observer("QtObservedInstanceBoard"),
   WorldSignedOn(false),
-  atomObservedValues("atom", *this),
-  moleculeObservedValues("molecule", *this),
+  atomObservedValues(
+      "atom",
+      *this,
+      boost::bind(&QtObservedInstanceBoard::atomcountsubjectKilled, this, _1)),
+  moleculeObservedValues(
+      "molecule",
+      *this,
+      boost::bind(&QtObservedInstanceBoard::moleculecountsubjectKilled, this, _1)),
+  atomSubjectKilled(
+      boost::bind(&ObservedValuesContainer<QtObservedAtom, atomId_t>::countsubjectKilled,
+          boost::ref(atomObservedValues),
+          _1)),
+  moleculeSubjectKilled(
+      boost::bind(&ObservedValuesContainer<QtObservedMolecule, moleculeId_t>::countsubjectKilled,
+          boost::ref(moleculeObservedValues),
+          _1)),
   lastremovedatom((atomId_t)-1),
   lastremovedatomsmolecule( std::make_pair((moleculeId_t)-1,(atomId_t)-1) ),
   lastremovedmolecule((moleculeId_t)-1)
 {
-  boost::function<void (const atomId_t _id)> atomfctor =
-      boost::bind(&QtObservedInstanceBoard::atomcountsubjectKilled, this, _1);
-  atomSubjectKilled = 
-      boost::bind(&ObservedValuesContainer<QtObservedAtom, atomId_t>::countsubjectKilled,
-          boost::ref(atomObservedValues),
-          _1,
-          atomfctor
-          );
-  boost::function<void (const moleculeId_t _id)> molfctor = 
-      boost::bind(&QtObservedInstanceBoard::moleculecountsubjectKilled, this, _1);
-  moleculeSubjectKilled = 
-      boost::bind(&ObservedValuesContainer<QtObservedMolecule, moleculeId_t>::countsubjectKilled,
-          boost::ref(moleculeObservedValues),
-          _1,
-          molfctor
-          );
-
   // be first (besides ObservedValues to know about new insertions)
   World::getInstance().signOn(this, World::AtomInserted, GlobalObservableInfo::PriorityLevel(int(-10)));
@@ -154,10 +153,11 @@
               _molecule,
               moleculeSubjectKilled);
+          QtObservedMolecule::ptr observedmolecule(new QtObservedMolecule(ObservedValues, *this));
 #ifndef NDEBUG
           bool status =
 #endif
-              moleculeObservedValues.insert(_id, ObservedValues);
+              moleculeObservedValues.insert(_id, observedmolecule);
           ASSERT( status,
-              "QtObservedInstanceBoard::recieveNotification() - could not insert ObservedValues for"
+              "QtObservedInstanceBoard::recieveNotification() - could not insert ObservedMolecule for"
               +toString(_id)+".");
           // we need to check for index changes
@@ -201,8 +201,9 @@
               _atom,
               atomSubjectKilled);
+          QtObservedAtom::ptr observedatom(new QtObservedAtom(ObservedValues, *this));
 #ifndef NDEBUG
           bool status  =
 #endif
-              atomObservedValues.insert(_id, ObservedValues);
+              atomObservedValues.insert(_id, observedatom);
           ASSERT( status,
               "QtObservedInstanceBoard::recieveNotification() - could not insert ObservedValues for"
@@ -307,14 +308,20 @@
 void QtObservedInstanceBoard::atomcountsubjectKilled(const atomId_t _atomid)
 {
-  if (_atomid == lastremovedatomsmolecule.second)
+  if ((_atomid == lastremovedatomsmolecule.second) && (_atomid == lastremovedatom)) {
+    LOG(3, "DEBUG: InstanceBoard emits atomRemoved for " << _atomid);
     emit atomRemoved(lastremovedatomsmolecule.first, lastremovedatomsmolecule.second);
-  else
+  } else
     ELOG(2, "QtObservedInstanceBoard::atomcountsubjectKilled() - id " << _atomid
-        << " not fitting with " << lastremovedatomsmolecule);
+        << " not fitting with " << lastremovedatomsmolecule << " or " << lastremovedatom);
 }
 
 void QtObservedInstanceBoard::moleculecountsubjectKilled(const moleculeId_t _molid)
 {
-  emit moleculeRemoved(_molid);
+  if (lastremovedmolecule == _molid) {
+    LOG(3, "DEBUG: InstanceBoard emits moleculeRemoved for " << _molid);
+    emit moleculeRemoved(_molid);
+  } else
+    ELOG(2, "QtObservedInstanceBoard::moleculecountsubjectKilled() - id " << _molid
+        << " not fitting with " << lastremovedmolecule);
 }
 
@@ -329,45 +336,21 @@
 }
 
-void QtObservedInstanceBoard::returnObservedAtom(const atomId_t _id)
-{
-  atomObservedValues.yield(_id);
-}
-
-void QtObservedInstanceBoard::returnObservedMolecule(const moleculeId_t _id)
-{
-  moleculeObservedValues.yield(_id);
-}
-
-ObservedValues_t QtObservedInstanceBoard::getAtomObservedValues(const atomId_t _id)
-{
-  return atomObservedValues.getObservedValues(_id);
-}
-ObservedValues_t QtObservedInstanceBoard::getMoleculeObservedValues(const moleculeId_t _id)
-{
-  return moleculeObservedValues.getObservedValues(_id);
-}
-
-void QtObservedInstanceBoard::returnAtomObservedValues(
-    const atomId_t _id,
-    ObservedValues_t &_observedvalues)
-{
-  if (lastremovedatom != _id) {
-    atomObservedValues.returnObservedValues(_id, _observedvalues);
-  } else {
-    lastremovedatom = (atomId_t)-1;
-    atomObservedValues.erase(_id);
-  }
-}
-
-void QtObservedInstanceBoard::returnMoleculeObservedValues(
-    const moleculeId_t _id,
-    ObservedValues_t &_observedvalues)
-{
-  if (lastremovedmolecule != _id) {
-    moleculeObservedValues.returnObservedValues(_id, _observedvalues);
-  } else {
-    lastremovedmolecule = (moleculeId_t)-1;
-    moleculeObservedValues.erase(_id);
-  }
-}
-
+void QtObservedInstanceBoard::markObservedAtomAsConnected(const atomId_t _id)
+{
+  atomObservedValues.markObservedValuesAsConnected(_id);
+}
+
+void QtObservedInstanceBoard::markObservedAtomAsDisconnected(const atomId_t _id)
+{
+  atomObservedValues.markObservedValuesAsDisconnected(_id);
+}
+
+void QtObservedInstanceBoard::markObservedMoleculeAsConnected(const moleculeId_t _id)
+{
+  moleculeObservedValues.markObservedValuesAsConnected(_id);
+}
+
+void QtObservedInstanceBoard::markObservedMoleculeAsDisconnected(const moleculeId_t _id)
+{
+  moleculeObservedValues.markObservedValuesAsDisconnected(_id);
+}
Index: src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp
===================================================================
--- src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp	(revision 90821d3e29139e45d3df56d7c7f116d631c88f26)
+++ src/UIElements/Qt4/InstanceBoard/QtObservedInstanceBoard.hpp	(revision 68418ebdce3a77f78915901a8e48bd7cf1632f6c)
@@ -81,12 +81,8 @@
   QtObservedAtom::ptr getObservedAtom(const atomId_t _id);
   QtObservedMolecule::ptr getObservedMolecule(const moleculeId_t _id);
-  void returnObservedAtom(const atomId_t _id);
-  void returnObservedMolecule(const moleculeId_t _id);
-
-  ObservedValues_t getAtomObservedValues(const atomId_t _id);
-  ObservedValues_t getMoleculeObservedValues(const moleculeId_t _id);
-
-  void returnAtomObservedValues(const atomId_t _id, ObservedValues_t &_observedvalues);
-  void returnMoleculeObservedValues(const moleculeId_t _id, ObservedValues_t &_observedvalues);
+  void markObservedAtomAsConnected(const atomId_t _id);
+  void markObservedAtomAsDisconnected(const atomId_t _id);
+  void markObservedMoleculeAsConnected(const moleculeId_t _id);
+  void markObservedMoleculeAsDisconnected(const moleculeId_t _id);
 
 signals:
Index: src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.cpp
===================================================================
--- src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.cpp	(revision 90821d3e29139e45d3df56d7c7f116d631c88f26)
+++ src/UIElements/Qt4/InstanceBoard/QtObservedMolecule.cpp	(revision 68418ebdce3a77f78915901a8e48bd7cf1632f6c)
@@ -84,5 +84,5 @@
   ObservedValues(_ObservedValues)
 {
-  activateObserver();
+  // activating Observer is done by ObservedValueContainer when it's prepared
 }
 
@@ -101,4 +101,5 @@
     owner = NULL;
     signedOffChannels = AllsignedOnChannels;
+    board.markObservedMoleculeAsDisconnected(getMolIndex());
   }
 }
@@ -132,5 +133,5 @@
     owner = NULL;
 
-    board.returnObservedMolecule(getMolIndex());
+    board.markObservedMoleculeAsDisconnected(getMolIndex());
   }
 }
