diff --git a/source/RobotAPI/libraries/armem/core/base/EntityBase.h b/source/RobotAPI/libraries/armem/core/base/EntityBase.h
index ab227c33ee321475f129d8f864b5cbf31e3f4845..0775a71f977fde16966550f0506e9fd0f591e9a5 100644
--- a/source/RobotAPI/libraries/armem/core/base/EntityBase.h
+++ b/source/RobotAPI/libraries/armem/core/base/EntityBase.h
@@ -114,13 +114,13 @@ namespace armarx::armem::base
         }
 
 
-        inline const std::map<Time, EntitySnapshotT>& history() const
+        inline const ContainerT& history() const
         {
             return this->_container;
         }
-        inline std::map<Time, EntitySnapshotT>& history()
+        inline ContainerT& history()
         {
-            return const_cast<std::map<Time, EntitySnapshotT>&>(const_cast<const EntityBase*>(this)->history());
+            return const_cast<ContainerT&>(const_cast<const EntityBase*>(this)->history());
         }
 
 
@@ -226,7 +226,7 @@ namespace armarx::armem::base
         virtual const EntitySnapshotT& getLatestSnapshotBeforeOrAt(const Time& time) const
         {
             // first element equal or greater
-            typename std::map<Time, EntitySnapshotT>::const_iterator refIt = this->_container.upper_bound(time);
+            typename ContainerT::const_iterator refIt = this->_container.upper_bound(time);
 
             if (refIt == this->_container.begin())
             {
@@ -238,7 +238,7 @@ namespace armarx::armem::base
             }
 
             // last element less than
-            typename std::map<Time, EntitySnapshotT>::const_iterator refItPrev = std::prev(refIt);
+            typename ContainerT::const_iterator refItPrev = std::prev(refIt);
 
             // ... or we return the element before if possible
             if (refItPrev != this->_container.begin())
@@ -259,7 +259,7 @@ namespace armarx::armem::base
         virtual const EntitySnapshotT& getLatestSnapshotBefore(const Time& time) const
         {
             // first element equal or greater
-            typename std::map<Time, EntitySnapshotT>::const_iterator refIt = this->_container.upper_bound(time);
+            typename ContainerT::const_iterator refIt = this->_container.upper_bound(time);
 
             if (refIt == this->_container.begin())
             {
@@ -267,7 +267,7 @@ namespace armarx::armem::base
             }
 
             // last element less than
-            typename std::map<Time, EntitySnapshotT>::const_iterator refItPrev = std::prev(refIt);
+            typename ContainerT::const_iterator refItPrev = std::prev(refIt);
 
             // we return the element before if possible
             if (refItPrev != this->_container.begin())
@@ -311,7 +311,7 @@ namespace armarx::armem::base
         virtual const EntitySnapshotT& getFirstSnapshotAfterOrAt(const Time& time) const
         {
             // first element equal or greater
-            typename std::map<Time, EntitySnapshotT>::const_iterator refIt = this->_container.upper_bound(time);
+            typename ContainerT::const_iterator refIt = this->_container.upper_bound(time);
 
             if (refIt == this->_container.end())
             {
@@ -330,7 +330,7 @@ namespace armarx::armem::base
         virtual const EntitySnapshotT& getFirstSnapshotAfter(const Time& time) const
         {
             // first element equal or greater
-            typename std::map<Time, EntitySnapshotT>::const_iterator refIt = this->_container.upper_bound(time);
+            typename ContainerT::const_iterator refIt = this->_container.upper_bound(time);
 
             if (refIt == this->_container.end())
             {
@@ -343,7 +343,7 @@ namespace armarx::armem::base
             }
 
             // first element greater than
-            typename std::map<Time, EntitySnapshotT>::const_iterator refItNext = std::next(refIt);
+            typename ContainerT::const_iterator refItNext = std::next(refIt);
 
             if (refItNext != this->_container.end())
             {
@@ -418,7 +418,7 @@ namespace armarx::armem::base
 
         EntitySnapshotT& addSnapshot(EntitySnapshotT&& snapshot)
         {
-            auto it = this->_container.emplace(snapshot.time(), std::move(snapshot)).first;
+            auto it = this->_container.emplace_hint(this->_container.end(), snapshot.time(), std::move(snapshot));
             it->second.id().setEntityID(this->id());
             return it->second;
         }
@@ -473,7 +473,9 @@ namespace armarx::armem::base
          * @return The latest snapshot.
          * @throw `armem::error::EntityHistoryEmpty` If the history is empty.
          */
-        virtual const typename std::map<Time, EntitySnapshotT>::value_type& getLatestItem() const
+        virtual
+        const typename ContainerT::value_type&
+        getLatestItem() const
         {
             if (this->_container.empty())
             {
diff --git a/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.cpp b/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.cpp
index 3865e6df0dfb2112d14d5ee23c40e3a740626307..a3c3b2e897fd1263d8cfffeea190e49f0a6da218 100644
--- a/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.cpp
+++ b/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.cpp
@@ -1,5 +1,6 @@
 #include "Entity.h"
 
+
 namespace armarx::armem::ltm
 {
 
@@ -106,7 +107,7 @@ namespace armarx::armem::ltm
             snapshot.addInstance(instance);
         }
 
-        _container.insert({time, snapshot});
+        _container.emplace(time, snapshot);
         //truncateHistoryToSize();
         return true;
     }
@@ -142,7 +143,7 @@ namespace armarx::armem::ltm
         return Base::getSnapshot(time);
     }
 
-    const std::map<Time, EntitySnapshot>::value_type& Entity::getLatestItem() const
+    auto Entity::getLatestItem() const -> const ContainerT::value_type&
     {
         // Directly query mongodb (cache cant know whether it is the latest or not)
         // TODO
diff --git a/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.h b/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.h
index a5bca08c7ee0b7aff2a79d2c45aa37fc4baec1c4..20377befd61f741a642e139aafe1de3c2cc7f24b 100644
--- a/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.h
+++ b/source/RobotAPI/libraries/armem/core/longtermmemory/Entity.h
@@ -71,7 +71,7 @@ namespace armarx::armem::ltm
 
     protected:
         // virtual overrides for LTM storage
-        virtual const std::map<Time, EntitySnapshot>::value_type& getLatestItem() const override;
+        virtual const ContainerT::value_type& getLatestItem() const override;
 
     public:
         MongoDBConnectionManager::MongoDBSettings dbsettings;