Index: /code/branches/core7/src/modules/objects/triggers/DistanceMultiTrigger.cc
===================================================================
--- /code/branches/core7/src/modules/objects/triggers/DistanceMultiTrigger.cc	(revision 10558)
+++ /code/branches/core7/src/modules/objects/triggers/DistanceMultiTrigger.cc	(revision 10559)
@@ -100,13 +100,12 @@
 
         // Check for objects that were in range but no longer are. Iterate through all objects, that are in range.
-        for(std::map<WorldEntity*, WeakPtr<WorldEntity>* >::iterator it = this->range_.begin(); it != this->range_.end(); )
+        for(std::set<WeakPtr<WorldEntity> >::iterator it = this->range_.begin(); it != this->range_.end(); )
         {
-            WorldEntity* entity = it->second->get();
-            WorldEntity* key = it->first;
-            it++; // Incrementing the iterator in advance, since we don't need the current anymore and we potentially are going to delete the current element thus invalidating the iterator.
+            WorldEntity* entity = *it;
+
             // If the entity no longer exists.
             if(entity == NULL)
             {
-                this->removeFromRange(key);
+                this->range_.erase(it++);
                 continue;
             }
@@ -116,7 +115,5 @@
             if (distanceVec.length() > this->distance_)
             {
-                // If for some reason the entity could not be removed.
-                if(!this->removeFromRange(key))
-                    continue;
+                this->range_.erase(it++);
 
                 // If no queue has been created, yet.
@@ -129,4 +126,8 @@
                 state->originator = entity;
                 queue->push(state);
+            }
+            else
+            {
+                ++it;
             }
         }
@@ -260,32 +261,6 @@
     bool DistanceMultiTrigger::addToRange(WorldEntity* entity)
     {
-        WeakPtr<WorldEntity>* weakptr = new WeakPtr<WorldEntity>(entity);
-        std::pair<std::map<WorldEntity*, WeakPtr<WorldEntity>* >::iterator, bool> pair = this->range_.insert(std::pair<WorldEntity*, WeakPtr<WorldEntity>* >(entity, weakptr));
-
-        if(!pair.second)
-        {
-            delete weakptr;
-            return false;
-        }
-
-        return true;
-    }
-
-    /**
-    @brief
-        Remove a given entity from the set of entities, that currently are in range of the DistanceMultiTrigger.
-    @param entity
-        A pointer ot the entity.
-    @return
-        Returns true if successful.
-    */
-    bool DistanceMultiTrigger::removeFromRange(WorldEntity* entity)
-    {
-        WeakPtr<WorldEntity>* weakptr = this->range_.find(entity)->second;
-        bool erased = this->range_.erase(entity) > 0;
-        if(erased)
-            delete weakptr;
-        return erased;
-    }
-
+        std::pair<std::set<WeakPtr<WorldEntity> >::iterator, bool> pair = this->range_.insert(entity);
+        return pair.second;
+    }
 }
Index: /code/branches/core7/src/modules/objects/triggers/DistanceMultiTrigger.h
===================================================================
--- /code/branches/core7/src/modules/objects/triggers/DistanceMultiTrigger.h	(revision 10558)
+++ /code/branches/core7/src/modules/objects/triggers/DistanceMultiTrigger.h	(revision 10559)
@@ -140,5 +140,4 @@
 
             bool addToRange(WorldEntity* entity); // Add a given entity to the entities, that currently are in range of the DistanceMultiTrigger.
-            bool removeFromRange(WorldEntity* entity); // Remove a given entity from the set of entities, that currently are in range of the DistanceMultiTrigger.
 
         private:
@@ -154,5 +153,5 @@
             ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
 
-            std::map<WorldEntity*, WeakPtr<WorldEntity>* > range_; //!< The set of entities that currently are in range of the DistanceMultiTrigger.
+            std::set<WeakPtr<WorldEntity> > range_; //!< The set of entities that currently are in range of the DistanceMultiTrigger.
 
     };
Index: /code/branches/core7/src/modules/pickup/PickupManager.cc
===================================================================
--- /code/branches/core7/src/modules/pickup/PickupManager.cc	(revision 10558)
+++ /code/branches/core7/src/modules/pickup/PickupManager.cc	(revision 10559)
@@ -96,6 +96,4 @@
 
         // Destroying all the WeakPointers that are still there.
-        for(std::map<uint32_t, WeakPtr<Pickupable>*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
-            delete it->second;
         this->pickups_.clear();
 
@@ -288,5 +286,5 @@
             // Add the Pickupable to the indexes_ and pickups_ lists.
             this->indexes_[pickup] = index;
-            this->pickups_[index] = new WeakPtr<Pickupable>(pickup);
+            this->pickups_[index] = pickup;
         }
         else // If it was dropped, it is removed from the required lists.
@@ -296,9 +294,7 @@
             index = it->second;
 
-            // Remove the Pickupable form the indexes_ and pickups_ list.
-            WeakPtr<Pickupable>* ptr = this->pickups_[index];
+            // Remove the Pickupable from the indexes_ and pickups_ list.
             this->indexes_.erase(it);
             this->pickups_.erase(index);
-            delete ptr;
         }
 
@@ -402,5 +398,5 @@
             if(this->pickups_.empty())
                 return;
-            Pickupable* pickupable = this->pickups_.find(pickup)->second->get();
+            Pickupable* pickupable = this->pickups_.find(pickup)->second;
             if(pickupable != NULL)
                 pickupable->drop();
@@ -445,5 +441,5 @@
             if(this->pickups_.empty())
                 return;
-            Pickupable* pickupable = this->pickups_.find(pickup)->second->get();
+            Pickupable* pickupable = this->pickups_.find(pickup)->second;
             if(pickupable != NULL)
                 pickupable->setUsed(use);
Index: /code/branches/core7/src/modules/pickup/PickupManager.h
===================================================================
--- /code/branches/core7/src/modules/pickup/PickupManager.h	(revision 10558)
+++ /code/branches/core7/src/modules/pickup/PickupManager.h	(revision 10559)
@@ -161,5 +161,5 @@
             std::map<uint32_t, PickupInventoryContainer*>::iterator pickupsIterator_; //!< An iterator pointing to the current Pickupable in pickupsList_.
 
-            std::map<uint32_t, WeakPtr<Pickupable>*> pickups_; //!< Map linking a number identifying a Pickupable to a weak pointer of a Pickupable.
+            std::map<uint32_t, WeakPtr<Pickupable> > pickups_; //!< Map linking a number identifying a Pickupable to a weak pointer of a Pickupable.
             std::map<Pickupable*, uint32_t> indexes_;//!< Map linking Pickupable to the number identifying it.
 
