Index: code/branches/pickup/src/libraries/network/Client.cc
===================================================================
--- code/branches/pickup/src/libraries/network/Client.cc	(revision 5815)
+++ code/branches/pickup/src/libraries/network/Client.cc	(revision 5935)
@@ -43,10 +43,12 @@
 #include <cassert>
 
+#include "util/Clock.h"
 #include "util/Debug.h"
-#include "core/Clock.h"
 #include "synchronisable/Synchronisable.h"
 #include "packet/Chat.h"
 #include "packet/Gamestate.h"
 #include "FunctionCallManager.h"
+#include "core/CoreIncludes.h"
+#include "core/Game.h"
 
 namespace orxonox
@@ -158,4 +160,20 @@
     return;
   }
+  
+  void Client::connectionClosed()
+  {
+    ObjectList<Synchronisable>::iterator it;
+    for(it = ObjectList<Synchronisable>::begin(); it; )
+    {
+      if( it->getSyncMode() != 0x0 )
+        (it++)->destroy();
+      else
+      {
+        ++it;
+      }
+    }
+    Game::getInstance().popState();
+    Game::getInstance().popState();
+  }
 
 }
Index: code/branches/pickup/src/libraries/network/Client.h
===================================================================
--- code/branches/pickup/src/libraries/network/Client.h	(revision 5815)
+++ code/branches/pickup/src/libraries/network/Client.h	(revision 5935)
@@ -45,4 +45,6 @@
 
 #include <string>
+
+#include "util/UtilPrereqs.h"
 #include "ClientConnection.h"
 #include "GamestateClient.h"
@@ -72,5 +74,6 @@
 
     void update(const Clock& time);
-
+  protected:
+    virtual void connectionClosed();
   private:
     Client(const Client& copy); // not used
Index: code/branches/pickup/src/libraries/network/ClientConnection.cc
===================================================================
--- code/branches/pickup/src/libraries/network/ClientConnection.cc	(revision 5815)
+++ code/branches/pickup/src/libraries/network/ClientConnection.cc	(revision 5935)
@@ -118,4 +118,5 @@
           case ENET_EVENT_TYPE_DISCONNECT:
             COUT(4) << "received disconnect confirmation from server" << endl;
+            this->connectionClosed();
             return true;
         }
@@ -123,4 +124,5 @@
     }
     enet_peer_reset( this->server_ );
+    this->connectionClosed();
     return false;
   }
@@ -133,13 +135,14 @@
   }
 
-  void ClientConnection::addClient(ENetEvent* event)
+  void ClientConnection::addPeer(ENetEvent* event)
   {
     assert(0);
   }
-  void ClientConnection::disconnectPeer(ENetEvent* event)
+  void ClientConnection::removePeer(ENetEvent* event)
   {
     this->established_=false;
     COUT(1) << "Received disconnect Packet from Server!" << endl;
         // server closed the connection
+    this->connectionClosed();
   }
 
Index: code/branches/pickup/src/libraries/network/ClientConnection.h
===================================================================
--- code/branches/pickup/src/libraries/network/ClientConnection.h	(revision 5815)
+++ code/branches/pickup/src/libraries/network/ClientConnection.h	(revision 5935)
@@ -53,7 +53,9 @@
     bool addPacket(ENetPacket *packet);
     inline bool isConnected(){ return this->established_; }
+  protected:
+    virtual void connectionClosed()=0;
   private:
-    virtual void addClient(ENetEvent* event);
-    virtual void disconnectPeer(ENetEvent* event);
+    virtual void addPeer(ENetEvent* event);
+    virtual void removePeer(ENetEvent* event);
     
     bool disconnectConnection();
Index: code/branches/pickup/src/libraries/network/ClientConnectionListener.cc
===================================================================
--- code/branches/pickup/src/libraries/network/ClientConnectionListener.cc	(revision 5815)
+++ code/branches/pickup/src/libraries/network/ClientConnectionListener.cc	(revision 5935)
@@ -33,21 +33,32 @@
 #include "ClientInformation.h"
 
-namespace orxonox{
+namespace orxonox
+{
+    ClientConnectionListener::ClientConnectionListener()
+    { 
+        RegisterRootObject(ClientConnectionListener); 
+    }
 
-  ClientConnectionListener::ClientConnectionListener()
-  { 
-    RegisterRootObject(ClientConnectionListener); 
-  }
+    void ClientConnectionListener::broadcastClientConnected(unsigned int clientID)
+    {
+        for (ObjectList<ClientConnectionListener>::iterator it = ObjectList<ClientConnectionListener>::begin(); it != ObjectList<ClientConnectionListener>::end(); ++it)
+            it->clientConnected(clientID);
+    }
+    
+    void ClientConnectionListener::broadcastClientDisconnected(unsigned int clientID)
+    {
+        for (ObjectList<ClientConnectionListener>::iterator it = ObjectList<ClientConnectionListener>::begin(); it != ObjectList<ClientConnectionListener>::end(); ++it)
+            it->clientDisconnected(clientID);
+    }
 
-  void ClientConnectionListener::getConnectedClients(){
-    if(GameMode::showsGraphics())
-      this->clientConnected(0); //server client id
-    ClientInformation *client = ClientInformation::getBegin();
-    while(client){
-      this->clientConnected(client->getID());
-      client=client->next();
+    void ClientConnectionListener::getConnectedClients()
+    {
+        ClientInformation* client = ClientInformation::getBegin();
+        while (client)
+        {
+            this->clientConnected(client->getID());
+            client = client->next();
+        }
     }
-  }
-
 }
 
Index: code/branches/pickup/src/libraries/network/ClientConnectionListener.h
===================================================================
--- code/branches/pickup/src/libraries/network/ClientConnectionListener.h	(revision 5815)
+++ code/branches/pickup/src/libraries/network/ClientConnectionListener.h	(revision 5935)
@@ -33,21 +33,21 @@
 #include "core/OrxonoxClass.h"
 
-namespace orxonox{
+namespace orxonox
+{
+    class _NetworkExport ClientConnectionListener : virtual public OrxonoxClass
+    {
+        public:
+            ClientConnectionListener();
+            virtual ~ClientConnectionListener() {}
+            
+            static void broadcastClientConnected(unsigned int clientID);
+            static void broadcastClientDisconnected(unsigned int clientID);
 
-  class _NetworkExport ClientConnectionListener : virtual public OrxonoxClass
-  {
-    friend class Server;
+            virtual void clientConnected(unsigned int clientID) = 0;
+            virtual void clientDisconnected(unsigned int clientID) = 0;
 
-  public:
-    ClientConnectionListener();
-    virtual ~ClientConnectionListener() {}
-
-    void getConnectedClients();
-
-  protected:
-    virtual void clientConnected(unsigned int clientID) = 0;
-    virtual void clientDisconnected(unsigned int clientID) = 0;
-  };
-
+        protected:
+            void getConnectedClients();
+    };
 }
 
Index: code/branches/pickup/src/libraries/network/Connection.cc
===================================================================
--- code/branches/pickup/src/libraries/network/Connection.cc	(revision 5815)
+++ code/branches/pickup/src/libraries/network/Connection.cc	(revision 5935)
@@ -83,8 +83,8 @@
         // log handling ================
         case ENET_EVENT_TYPE_CONNECT:
-          addClient( &event );
+          addPeer( &event );
           break;
         case ENET_EVENT_TYPE_DISCONNECT:
-          disconnectPeer( &event );
+          removePeer( &event );
           break;
         case ENET_EVENT_TYPE_RECEIVE:
Index: code/branches/pickup/src/libraries/network/Connection.h
===================================================================
--- code/branches/pickup/src/libraries/network/Connection.h	(revision 5815)
+++ code/branches/pickup/src/libraries/network/Connection.h	(revision 5935)
@@ -64,9 +64,9 @@
     
     int service(ENetEvent* event);
-    void disconnectPeer(ENetPeer *peer);
+    virtual void disconnectPeer(ENetPeer *peer);
     
     void processQueue();
-    virtual void addClient(ENetEvent* event)=0;
-    virtual void disconnectPeer(ENetEvent* event)=0;
+    virtual void addPeer(ENetEvent* event)=0;
+    virtual void removePeer(ENetEvent* event)=0;
     virtual bool processPacket(ENetEvent* event);
     
Index: code/branches/pickup/src/libraries/network/GamestateClient.cc
===================================================================
--- code/branches/pickup/src/libraries/network/GamestateClient.cc	(revision 5815)
+++ code/branches/pickup/src/libraries/network/GamestateClient.cc	(revision 5935)
@@ -108,5 +108,5 @@
     ObjectList<Synchronisable>::iterator temp=it;
     ++it;
-    delete  *temp;
+    temp->destroy(); // or delete?
   }
 
Index: code/branches/pickup/src/libraries/network/GamestateManager.cc
===================================================================
--- code/branches/pickup/src/libraries/network/GamestateManager.cc	(revision 5815)
+++ code/branches/pickup/src/libraries/network/GamestateManager.cc	(revision 5935)
@@ -77,5 +77,5 @@
         delete (*it2).second;
     }
-    delete this->trafficControl_;
+    this->trafficControl_->destroy();
 //     delete this->threadMutex_;
 //     delete this->threadPool_;
@@ -160,6 +160,5 @@
       finishGamestate( cid, &clientGamestates.back(), client, reference );
       //FunctorMember<GamestateManager>* functor = 
-//       ExecutorMember<GamestateManager>* executor = createExecutor( createFunctor(&GamestateManager::finishGamestate) );
-//       executor->setObject(this);
+//       ExecutorMember<GamestateManager>* executor = createExecutor( createFunctor(&GamestateManager::finishGamestate, this) );
 //       executor->setDefaultValues( cid, &clientGamestates.back(), client, reference );
 //       (*static_cast<Executor*>(executor))();
Index: code/branches/pickup/src/libraries/network/NetworkFunction.cc
===================================================================
--- code/branches/pickup/src/libraries/network/NetworkFunction.cc	(revision 5815)
+++ code/branches/pickup/src/libraries/network/NetworkFunction.cc	(revision 5935)
@@ -60,5 +60,5 @@
     std::map<std::string, NetworkFunctionBase*>::iterator it;
     for( it=NetworkFunctionBase::nameMap_.begin(); it!=NetworkFunctionBase::nameMap_.end(); ++it )
-      delete it->second;
+      it->second->destroy();
   }
   
Index: code/branches/pickup/src/libraries/network/NetworkPrereqs.h
===================================================================
--- code/branches/pickup/src/libraries/network/NetworkPrereqs.h	(revision 5815)
+++ code/branches/pickup/src/libraries/network/NetworkPrereqs.h	(revision 5935)
@@ -28,6 +28,7 @@
 
 /**
-  @file
-  @brief Contains all the necessary forward declarations for all classes and structs.
+@file
+@brief
+    Shared library macros, enums, constants and forward declarations for the network library
 */
 
@@ -40,4 +41,5 @@
 // Shared library settings
 //-----------------------------------------------------------------------
+
 #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( NETWORK_STATIC_BUILD )
 #  ifdef NETWORK_SHARED_BUILD
@@ -57,11 +59,31 @@
 
 //-----------------------------------------------------------------------
-// Library global contants
+// Constants
 //-----------------------------------------------------------------------
+
 namespace orxonox
 {
   static const unsigned int GAMESTATEID_INITIAL = static_cast<unsigned int>(-1);
   static const unsigned int CLIENTID_UNKNOWN    = static_cast<unsigned int>(-2);
-  static const uint32_t     OBJECTID_UNKNOWN    = static_cast<uint32_t>(-1);
+}
+
+//-----------------------------------------------------------------------
+// Enums
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+  namespace packet
+  {
+    namespace PacketFlag
+    {
+      enum Value
+      {
+        Reliable   = 1,
+        Unsequence = 2,
+        NoAllocate = 4
+      };
+    }
+  }
 }
 
@@ -84,37 +106,26 @@
 namespace orxonox
 {
+  class ChatListener;
   class Client;
   class ClientConnection;
   class ClientConnectionListener;
-  class ClientFrameListener;
   class ClientInformation;
   class Connection;
   class FunctionCallManager;
   class GamestateClient;
+  class GamestateHandler;
   class GamestateManager;
-  class GamestateHandler;
-  class NetworkCallbackBase;
-  template <class T> class NetworkCallback;
-  class NetworkCallbackManager;
+  class Host;
   class NetworkFunctionBase;
+  struct NetworkFunctionPointer;
   class NetworkFunctionStatic;
+  template <class T>
+  class NetworkMemberFunction;
   class NetworkMemberFunctionBase;
-  template <class T> class NetworkMemeberFunction;
-  struct NetworkFunctionPointer;
   class Server;
   class ServerConnection;
-  class ServerFrameListener;
-  class Synchronisable;
-  class SynchronisableVariableBase;
-  template <class T> class SynchronisableVariable;
-  template <class T> class SynchronisableVariableBidirectional;
-  struct ClientList;
-  struct PacketEnvelope;
-  struct QueueItem;
-  struct syncData;
   class TrafficControl;
-  class obj;
-  class objInfo;
 
+  // packet
   namespace packet
   {
@@ -122,21 +133,24 @@
     class Chat;
     class ClassID;
+    class DeleteObjects;
     class FunctionCalls;
     class FunctionIDs;
     class Gamestate;
-    class NetworkIDs;
     class Packet;
     class Welcome;
+  }
 
-    namespace PacketFlag
-    {
-      enum Value
-      {
-        Reliable   = 1,
-        Unsequence = 2,
-        NoAllocate = 4
-      };
-    }
-  }
+  // synchronisable
+  template <class T>
+  class NetworkCallback;
+  class NetworkCallbackBase;
+  class NetworkCallbackManager;
+  class Synchronisable;
+  class SynchronisableHeader;
+  template <class T>
+  class SynchronisableVariable;
+  class SynchronisableVariableBase;
+  template <class T>
+  class SynchronisableVariableBidirectional;
 }
 
Index: code/branches/pickup/src/libraries/network/Server.cc
===================================================================
--- code/branches/pickup/src/libraries/network/Server.cc	(revision 5815)
+++ code/branches/pickup/src/libraries/network/Server.cc	(revision 5935)
@@ -46,6 +46,6 @@
 #include <string>
 
+#include "util/Clock.h"
 #include "util/Debug.h"
-#include "core/Clock.h"
 #include "core/ObjectList.h"
 #include "core/Executor.h"
@@ -245,5 +245,8 @@
     packet::DeleteObjects *del = new packet::DeleteObjects();
     if(!del->fetchIDs())
+    {
+      delete del;
       return true;  //everything ok (no deletes this tick)
+    }
 //     COUT(3) << "sending DeleteObjects" << std::endl;
     while(temp != NULL){
@@ -267,5 +270,5 @@
 
 
-  void Server::addClient(ENetEvent *event){
+  void Server::addPeer(ENetEvent *event){
     static unsigned int newid=1;
 
@@ -279,9 +282,5 @@
 
     // inform all the listeners
-    ObjectList<ClientConnectionListener>::iterator listener = ObjectList<ClientConnectionListener>::begin();
-    while(listener){
-      listener->clientConnected(newid);
-      listener++;
-    }
+    ClientConnectionListener::broadcastClientConnected(newid);
 
     ++newid;
@@ -290,4 +289,18 @@
     createClient(temp->getID());
 }
+
+  void Server::removePeer(ENetEvent *event)
+  {
+    COUT(4) << "removing client from list" << std::endl;
+    ClientInformation *client = ClientInformation::findClient(&event->peer->address);
+    if(!client)
+      return;
+    else
+    {
+      //ServerConnection::disconnectClient( client );
+      ClientConnectionListener::broadcastClientDisconnected( client->getID() );
+      delete client;
+    }
+  }
 
   bool Server::createClient(int clientID){
@@ -329,11 +342,6 @@
     ServerConnection::disconnectClient( client );
     GamestateManager::removeClient(client);
-// inform all the listeners
-    ObjectList<ClientConnectionListener>::iterator listener = ObjectList<ClientConnectionListener>::begin();
-    while(listener){
-      listener->clientDisconnected(client->getID());
-      ++listener;
-    }
-    delete client; //remove client from list
+    // inform all the listeners
+    ClientConnectionListener::broadcastClientDisconnected(client->getID());
   }
 
Index: code/branches/pickup/src/libraries/network/Server.h
===================================================================
--- code/branches/pickup/src/libraries/network/Server.h	(revision 5815)
+++ code/branches/pickup/src/libraries/network/Server.h	(revision 5935)
@@ -32,4 +32,5 @@
 #include "NetworkPrereqs.h"
 
+#include "util/UtilPrereqs.h"
 #include "core/CorePrereqs.h"
 #include "Host.h"
@@ -65,5 +66,7 @@
     unsigned int playerID(){return 0;}
     
-    void addClient(ENetEvent *event);
+    void addPeer(ENetEvent *event);
+    void removePeer(ENetEvent *event);
+    
     bool createClient(int clientID);
     void disconnectClient( ClientInformation *client);
Index: code/branches/pickup/src/libraries/network/ServerConnection.cc
===================================================================
--- code/branches/pickup/src/libraries/network/ServerConnection.cc	(revision 5815)
+++ code/branches/pickup/src/libraries/network/ServerConnection.cc	(revision 5935)
@@ -103,15 +103,4 @@
   {
     Connection::disconnectPeer( client->getPeer() );
-    delete client;
-  }
-  
-  void ServerConnection::disconnectPeer( ENetEvent* event )
-  {
-    COUT(4) << "removing client from list" << std::endl;
-    ClientInformation *client = ClientInformation::findClient(&event->peer->address);
-    if(!client)
-      return;
-    else
-      ServerConnection::disconnectClient( client );
   }
   
@@ -119,5 +108,5 @@
     ClientInformation *client = ClientInformation::findClient(clientID);
     if(client)
-      disconnectClient(client);
+      ServerConnection::disconnectClient(client);
   }
 
@@ -126,5 +115,5 @@
     ClientInformation *temp = ClientInformation::getBegin();
     while(temp!=0){
-      disconnectClient( temp );
+      ServerConnection::disconnectClient( temp );
       temp = temp->next();
     }
@@ -141,6 +130,5 @@
           break;
         case ENET_EVENT_TYPE_DISCONNECT:
-          if(ClientInformation::findClient(&(event.peer->address)))
-            delete ClientInformation::findClient(&(event.peer->address));
+          removePeer( &event );
           temp = ClientInformation::getBegin();
           break;
Index: code/branches/pickup/src/libraries/network/ServerConnection.h
===================================================================
--- code/branches/pickup/src/libraries/network/ServerConnection.h	(revision 5815)
+++ code/branches/pickup/src/libraries/network/ServerConnection.h	(revision 5935)
@@ -59,5 +59,4 @@
     static bool addPacketAll(ENetPacket *packet);
     virtual void disconnectClient(ClientInformation *client);
-    void disconnectPeer( ENetEvent* event );
     void disconnectClient(int clientID);
   protected:
Index: code/branches/pickup/src/libraries/network/packet/CMakeLists.txt
===================================================================
--- code/branches/pickup/src/libraries/network/packet/CMakeLists.txt	(revision 5815)
+++ code/branches/pickup/src/libraries/network/packet/CMakeLists.txt	(revision 5935)
@@ -1,3 +1,4 @@
 ADD_SOURCE_FILES(NETWORK_SRC_FILES
+COMPILATION_BEGIN PacketCompilation.cc
   Acknowledgement.cc
   Chat.cc
@@ -9,4 +10,5 @@
   Packet.cc
   Welcome.cc
+COMPILATION_END
 )
 
Index: code/branches/pickup/src/libraries/network/packet/ClassID.cc
===================================================================
--- code/branches/pickup/src/libraries/network/packet/ClassID.cc	(revision 5815)
+++ code/branches/pickup/src/libraries/network/packet/ClassID.cc	(revision 5935)
@@ -49,20 +49,18 @@
   Identifier *id;
   std::string classname;
-  unsigned int nrOfClasses=0; 
+  unsigned int nrOfClasses=0;
   unsigned int packetSize=2*sizeof(uint32_t); //space for the packetID and for the nrofclasses
   uint32_t network_id;
   flags_ = flags_ | PACKET_FLAGS_CLASSID;
   std::queue<std::pair<uint32_t, std::string> > tempQueue;
-  
+
   //calculate total needed size (for all strings and integers)
-  std::map<std::string, Identifier*>::const_iterator it = Factory::getFactoryMapBegin();
-  for(;it != Factory::getFactoryMapEnd();++it){
+  std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapBegin();
+  for(;it != Identifier::getStringIdentifierMapEnd();++it){
     id = (*it).second;
-    if(id == NULL)
+    if(id == NULL || !id->hasFactory())
       continue;
     classname = id->getName();
     network_id = id->getNetworkID();
-    if(network_id==0)
-      COUT(3) << "we got a null class id: " << id->getName() << std::endl;
     // now push the network id and the classname to the stack
     tempQueue.push( std::pair<unsigned int, std::string>(network_id, classname) );
@@ -70,15 +68,15 @@
     packetSize += (classname.size()+1)+sizeof(uint32_t)+sizeof(uint32_t);
   }
-  
+
   this->data_=new uint8_t[ packetSize ];
   //set the appropriate packet id
   assert(this->data_);
   *(Type::Value *)(this->data_ + _PACKETID ) = Type::ClassID;
-  
+
   uint8_t *temp=data_+sizeof(uint32_t);
   // save the number of all classes
   *(uint32_t*)temp = nrOfClasses;
   temp += sizeof(uint32_t);
-  
+
   // now save all classids and classnames
   std::pair<uint32_t, std::string> tempPair;
@@ -91,7 +89,7 @@
     temp+=2*sizeof(uint32_t)+tempPair.second.size()+1;
   }
-  
+
   COUT(5) << "classid packetSize is " << packetSize << endl;
-  
+
 }
 
@@ -111,5 +109,5 @@
   temp += sizeof(uint32_t);
   totalsize += sizeof(uint32_t); // storage size for nr of all classes
-  
+
   for(unsigned int i=0; i<nrOfClasses; i++){
     totalsize += 2*sizeof(uint32_t) + *(uint32_t*)(temp + sizeof(uint32_t));
@@ -125,9 +123,9 @@
   uint32_t stringsize;
   unsigned char *classname;
-  
-  
-  //clean the map of network ids
-  Factory::cleanNetworkIDs();
-  
+
+
+  //clear the map of network ids
+  Identifier::clearNetworkIDs();
+
   COUT(4) << "=== processing classids: " << endl;
   std::pair<uint32_t, std::string> tempPair;
@@ -136,5 +134,5 @@
   nrOfClasses = *(uint32_t*)temp;
   temp += sizeof(uint32_t);
-  
+
   for( int i=0; i<nrOfClasses; i++){
     networkID = *(uint32_t*)temp;
Index: code/branches/pickup/src/libraries/network/packet/Gamestate.cc
===================================================================
--- code/branches/pickup/src/libraries/network/packet/Gamestate.cc	(revision 5815)
+++ code/branches/pickup/src/libraries/network/packet/Gamestate.cc	(revision 5935)
@@ -378,4 +378,5 @@
   rawDiff( dest2, dest, basep, header_->getDataSize(), base->header_->getDataSize() );
   assert( memcmp( dest2, gs, dest_length) == 0 );
+  delete dest2;
 #endif
 
Index: code/branches/pickup/src/libraries/network/synchronisable/Synchronisable.cc
===================================================================
--- code/branches/pickup/src/libraries/network/synchronisable/Synchronisable.cc	(revision 5815)
+++ code/branches/pickup/src/libraries/network/synchronisable/Synchronisable.cc	(revision 5935)
@@ -47,7 +47,7 @@
   /**
   * Constructor:
-  * Initializes all Variables and sets the right objectID
+  * Initializes all Variables and sets the right objectID_
   */
-  Synchronisable::Synchronisable(BaseObject* creator){
+  Synchronisable::Synchronisable(BaseObject* creator ){
     RegisterRootObject(Synchronisable);
     static uint32_t idCounter=0;
@@ -55,14 +55,11 @@
     if ( GameMode::isMaster() || ( Host::running() && Host::isServer() ) )
     {
-      this->objectID = idCounter++; //this is only needed when running a server
-    //add synchronisable to the objectMap
-      objectMap_[this->objectID] = this;
+      this->setObjectID( idCounter++ );
     }
     else
     {
-      objectID=OBJECTID_UNKNOWN;
-      this->setObjectMode(0x0);   //make sure this object doesn't get synchronized
-    }
-    classID = static_cast<uint32_t>(-1);
+      objectID_=OBJECTID_UNKNOWN;
+    }
+    classID_ = static_cast<uint32_t>(-1);
     
     // set dataSize to 0
@@ -72,7 +69,10 @@
 
     // get creator id
-    this->creatorID = OBJECTID_UNKNOWN;
-
-    searchcreatorID:
+    if( creator )
+      this->creatorID_ = creator->getSceneID();
+    else
+      this->creatorID_ = OBJECTID_UNKNOWN;
+
+    /*searchcreatorID:
     if (creator)
     {
@@ -80,5 +80,5 @@
         if (synchronisable_creator && synchronisable_creator->objectMode_)
         {
-            this->creatorID = synchronisable_creator->getObjectID();
+            this->creatorID = synchronisable_creator->getScene()->getObjectID();
         }
         else if (creator != creator->getCreator())
@@ -87,10 +87,10 @@
             goto searchcreatorID;
         }
-    }
+    }*/
   }
 
   /**
    * Destructor:
-   * Delete all callback objects and remove objectID from the objectMap_
+   * Delete all callback objects and remove objectID_ from the objectMap_
    */
   Synchronisable::~Synchronisable(){
@@ -99,5 +99,5 @@
       // remove object from the static objectMap
       if (this->objectMode_ != 0x0 && (Host::running() && Host::isServer()))
-        deletedObjects_.push(objectID);
+        deletedObjects_.push(objectID_);
     }
     // delete all Synchronisable Variables from syncList ( which are also in stringList )
@@ -107,5 +107,5 @@
     stringList.clear();
     std::map<uint32_t, Synchronisable*>::iterator it;
-    it = objectMap_.find(objectID);
+    it = objectMap_.find(objectID_);
     if (it != objectMap_.end())
       objectMap_.erase(it);
@@ -172,11 +172,12 @@
     Synchronisable *no = orxonox_cast<Synchronisable*>(bo);
     assert(no);
-    no->objectID=header.getObjectID();
-    no->creatorID=header.getCreatorID(); //TODO: remove this
-    no->classID=header.getClassID();
-    COUT(4) << "fabricate objectID: " << no->objectID << " classID: " << no->classID << std::endl;
+    assert( Synchronisable::objectMap_.find(header.getObjectID()) == Synchronisable::objectMap_.end() );
+    no->setObjectID(header.getObjectID());
+    //no->creatorID=header.getCreatorID(); //TODO: remove this
+    no->setClassID(header.getClassID());
+    assert(no->creatorID_ == header.getCreatorID());
+    //assert(no->classID_ == header.getClassID());
+    COUT(4) << "fabricate objectID_: " << no->objectID_ << " classID_: " << no->classID_ << std::endl;
           // update data and create object/entity...
-    assert( Synchronisable::objectMap_.find(header.getObjectID()) == Synchronisable::objectMap_.end() );
-    Synchronisable::objectMap_[header.getObjectID()] = no;
     bool b = no->updateData(mem, mode, true);
     assert(b);
@@ -191,15 +192,15 @@
 
   /**
-   * Finds and deletes the Synchronisable with the appropriate objectID
-   * @param objectID objectID of the Synchronisable
+   * Finds and deletes the Synchronisable with the appropriate objectID_
+   * @param objectID_ objectID_ of the Synchronisable
    * @return true/false
    */
-  bool Synchronisable::deleteObject(uint32_t objectID){
-    if(!getSynchronisable(objectID))
+  bool Synchronisable::deleteObject(uint32_t objectID_){
+    if(!getSynchronisable(objectID_))
       return false;
-    assert(getSynchronisable(objectID)->objectID==objectID);
-    Synchronisable *s = getSynchronisable(objectID);
+    assert(getSynchronisable(objectID_)->objectID_==objectID_);
+    Synchronisable *s = getSynchronisable(objectID_);
     if(s)
-      delete s;
+      s->destroy(); // or delete?
     else
       return false;
@@ -208,11 +209,11 @@
 
   /**
-   * This function looks up the objectID in the objectMap_ and returns a pointer to the right Synchronisable
-   * @param objectID objectID of the Synchronisable
-   * @return pointer to the Synchronisable with the objectID
-   */
-  Synchronisable* Synchronisable::getSynchronisable(uint32_t objectID){
+   * This function looks up the objectID_ in the objectMap_ and returns a pointer to the right Synchronisable
+   * @param objectID_ objectID_ of the Synchronisable
+   * @return pointer to the Synchronisable with the objectID_
+   */
+  Synchronisable* Synchronisable::getSynchronisable(uint32_t objectID_){
     std::map<uint32_t, Synchronisable*>::iterator it1;
-    it1 = objectMap_.find(objectID);
+    it1 = objectMap_.find(objectID_);
     if (it1 != objectMap_.end())
       return it1->second;
@@ -220,6 +221,6 @@
 //     ObjectList<Synchronisable>::iterator it;
 //     for(it = ObjectList<Synchronisable>::begin(); it; ++it){
-//       if( it->getObjectID()==objectID ){
-//         objectMap_[objectID] = *it;
+//       if( it->getObjectID()==objectID_ ){
+//         objectMap_[objectID_] = *it;
 //         return *it;
 //       }
@@ -231,8 +232,8 @@
 
   /**
-   * This function takes all SynchronisableVariables out of the Synchronisable and saves them together with the size, objectID and classID to the given memory
+   * This function takes all SynchronisableVariables out of the Synchronisable and saves them together with the size, objectID_ and classID_ to the given memory
    * takes a pointer to already allocated memory (must have at least getSize bytes length)
    * structure of the bitstream:
-   * |totalsize,objectID,classID,var1,var2,string1_length,string1,var3,...|
+   * |totalsize,objectID_,classID_,var1,var2,string1_length,string1,var3,...|
    * length of varx: size saved int syncvarlist
    * @param mem pointer to allocated memory with enough size
@@ -252,13 +253,14 @@
     uint32_t tempsize = 0;
 #ifndef NDEBUG
-    if (this->classID==0)
+    if (this->classID_==0)
       COUT(3) << "classid 0 " << this->getIdentifier()->getName() << std::endl;
 #endif
 
-    if (this->classID == static_cast<uint32_t>(-1))
-        this->classID = this->getIdentifier()->getNetworkID();
-
-    assert(ClassByID(this->classID));
-    assert(this->classID==this->getIdentifier()->getNetworkID());
+    if (this->classID_ == static_cast<uint32_t>(-1))
+        this->classID_ = this->getIdentifier()->getNetworkID();
+
+    assert(ClassByID(this->classID_));
+    assert(this->classID_==this->getIdentifier()->getNetworkID());
+    assert(this->objectID_!=OBJECTID_UNKNOWN);
     std::vector<SynchronisableVariableBase*>::iterator i;
 
@@ -269,5 +271,5 @@
 
 
-    COUT(5) << "Synchronisable getting data from objectID: " << objectID << " classID: " << classID << std::endl;
+    COUT(5) << "Synchronisable getting data from objectID_: " << objectID_ << " classID_: " << classID_ << std::endl;
     // copy to location
     for(i=syncList.begin(); i!=syncList.end(); ++i){
@@ -277,7 +279,7 @@
     
     tempsize += SynchronisableHeader::getSize();
-    header.setObjectID( this->objectID );
-    header.setCreatorID( this->creatorID );
-    header.setClassID( this->classID );
+    header.setObjectID( this->objectID_ );
+    header.setCreatorID( this->creatorID_ );
+    header.setClassID( this->classID_ );
     header.setDataAvailable( true );
     header.setDataSize( tempsize );
@@ -311,7 +313,7 @@
     // start extract header
     SynchronisableHeader syncHeader(mem);
-    assert(syncHeader.getObjectID()==this->objectID);
-    assert(syncHeader.getCreatorID()==this->creatorID);
-    assert(syncHeader.getClassID()==this->classID);
+    assert(syncHeader.getObjectID()==this->objectID_);
+    assert(syncHeader.getCreatorID()==this->creatorID_);
+    assert(syncHeader.getClassID()==this->classID_);
     if(syncHeader.isDataAvailable()==false){
       mem += syncHeader.getDataSize();
@@ -322,5 +324,5 @@
     // stop extract header
 
-    //COUT(5) << "Synchronisable: objectID " << syncHeader.getObjectID() << ", classID " << syncHeader.getClassID() << " size: " << syncHeader.getDataSize() << " synchronising data" << std::endl;
+    //COUT(5) << "Synchronisable: objectID_ " << syncHeader.getObjectID() << ", classID_ " << syncHeader.getClassID() << " size: " << syncHeader.getDataSize() << " synchronising data" << std::endl;
     for(i=syncList.begin(); i!=syncList.end(); i++)
     {
@@ -361,9 +363,9 @@
     if(mode==0x0)
       mode=state_;
-    return ( (objectMode_&mode)!=0 && (!syncList.empty() ) );
-  }
-
-  /**
-   * This function looks at the header located in the bytestream and checks wheter objectID and classID match with the Synchronisables ones
+    return ( (this->objectMode_ & mode)!=0 && (!syncList.empty() ) );
+  }
+
+  /**
+   * This function looks at the header located in the bytestream and checks wheter objectID_ and classID_ match with the Synchronisables ones
    * @param mem pointer to the bytestream
    */
@@ -371,5 +373,5 @@
   {
     SynchronisableHeader header(mem);
-    assert(header.getObjectID()==this->objectID);
+    assert(header.getObjectID()==this->objectID_);
     return header.isDataAvailable();
   }
@@ -383,7 +385,7 @@
    * @param mode same as in registerVar
    */
-  void Synchronisable::setObjectMode(uint8_t mode){
+  void Synchronisable::setSyncMode(uint8_t mode){
     assert(mode==0x0 || mode==0x1 || mode==0x2 || mode==0x3);
-    objectMode_=mode;
+    this->objectMode_=mode;
   }
 
Index: code/branches/pickup/src/libraries/network/synchronisable/Synchronisable.h
===================================================================
--- code/branches/pickup/src/libraries/network/synchronisable/Synchronisable.h	(revision 5815)
+++ code/branches/pickup/src/libraries/network/synchronisable/Synchronisable.h	(revision 5935)
@@ -68,11 +68,11 @@
    * @brief: stores information about a Synchronisable 
    * 
-   * This class stores the information about a Synchronisable (objectID, classID, creatorID, dataSize)
+   * This class stores the information about a Synchronisable (objectID_, classID_, creatorID_, dataSize)
    * in an emulated bitset.
    * Bit 1 to 31 store the size of the Data the synchronisable consumes in the stream
    * Bit 32 is a bool and defines whether the data is actually stored or is just filled up with 0
-   * Byte 5 to 8: objectID
-   * Byte 9 to 12: classID
-   * Byte 13 to 16: creatorID
+   * Byte 5 to 8: objectID_
+   * Byte 9 to 12: classID_
+   * Byte 13 to 16: creatorID_
    */
   class _NetworkExport SynchronisableHeader{
@@ -94,14 +94,14 @@
       inline uint32_t getObjectID() const
         { return *(uint32_t*)(data_+4); }
-      inline void setObjectID(uint32_t objectID)
-        { *(uint32_t*)(data_+4) = objectID; }
+      inline void setObjectID(uint32_t objectID_)
+        { *(uint32_t*)(data_+4) = objectID_; }
       inline uint32_t getClassID() const
         { return *(uint32_t*)(data_+8); }
-      inline void setClassID(uint32_t classID)
-        { *(uint32_t*)(data_+8) = classID; }
+      inline void setClassID(uint32_t classID_)
+        { *(uint32_t*)(data_+8) = classID_; }
       inline uint32_t getCreatorID() const
         { return *(uint32_t*)(data_+12); }
-      inline void setCreatorID(uint32_t creatorID)
-        { *(uint32_t*)(data_+12) = creatorID; }
+      inline void setCreatorID(uint32_t creatorID_)
+        { *(uint32_t*)(data_+12) = creatorID_; }
       inline void operator=(SynchronisableHeader& h)
         { memcpy(data_, h.data_, getSize()); }
@@ -122,13 +122,16 @@
 
     static Synchronisable *fabricate(uint8_t*& mem, uint8_t mode=0x0);
-    static bool deleteObject(uint32_t objectID);
-    static Synchronisable *getSynchronisable(uint32_t objectID);
+    static bool deleteObject(uint32_t objectID_);
+    static Synchronisable *getSynchronisable(uint32_t objectID_);
     static unsigned int getNumberOfDeletedObject(){ return deletedObjects_.size(); }
     static uint32_t popDeletedObject(){ uint32_t i = deletedObjects_.front(); deletedObjects_.pop(); return i; }
 
-    inline uint32_t getObjectID() const {return objectID;}
-    inline unsigned int getCreatorID() const {return creatorID;}
-    inline uint32_t getClassID() const {return classID;}
-    inline unsigned int getPriority() const { return objectFrequency_;}
+    inline uint32_t getObjectID() const {return this->objectID_;}
+    inline unsigned int getCreatorID() const {return this->creatorID_;}
+    inline uint32_t getClassID() const {return this->classID_;}
+    inline unsigned int getPriority() const { return this->objectFrequency_;}
+    inline uint8_t getSyncMode() const { return this->objectMode_; }
+    
+    void setSyncMode(uint8_t mode);
 
   protected:
@@ -136,5 +139,4 @@
     template <class T> void registerVariable(T& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false);
     //template <class T> void unregisterVariable(T& var);
-    void setObjectMode(uint8_t mode);
     void setPriority(unsigned int freq){ objectFrequency_ = freq; }
 
@@ -146,8 +148,11 @@
     bool isMyData(uint8_t* mem);
     bool doSync(int32_t id, uint8_t mode=0x0);
-
-    uint32_t objectID;
-    uint32_t creatorID;
-    uint32_t classID;
+    
+    inline void setObjectID(uint32_t id){ this->objectID_ = id; objectMap_[this->objectID_] = this; }
+    inline void setClassID(uint32_t id){ this->classID_ = id; }
+
+    uint32_t objectID_;
+    uint32_t creatorID_;
+    uint32_t classID_;
 
     std::vector<SynchronisableVariableBase*> syncList;
