Index: code/branches/masterserver/src/libraries/network/CMakeLists.txt
===================================================================
--- code/branches/masterserver/src/libraries/network/CMakeLists.txt	(revision 7729)
+++ code/branches/masterserver/src/libraries/network/CMakeLists.txt	(revision 7730)
@@ -37,4 +37,7 @@
   Host.cc
   Server.cc
+  MasterServer.cc
+  PeerList.cc
+  ServerList.cc
   ServerConnection.cc
   TrafficControl.cc
@@ -62,4 +65,7 @@
   NetworkPrereqs.h
   Server.h
+  MasterServer.h
+  PeerList.h
+  ServerList.h
   ServerConnection.h
   TrafficControl.h
@@ -68,5 +74,4 @@
 ADD_SUBDIRECTORY(packet)
 ADD_SUBDIRECTORY(synchronisable)
-ADD_SUBDIRECTORY(masterserver)
 
 ORXONOX_ADD_LIBRARY(network
Index: code/branches/masterserver/src/libraries/network/MasterServer.h
===================================================================
--- code/branches/masterserver/src/libraries/network/MasterServer.h	(revision 7729)
+++ code/branches/masterserver/src/libraries/network/MasterServer.h	(revision 7730)
@@ -56,4 +56,7 @@
       ~MasterServer();
 
+      /* main routine */
+      int run();
+
     private:
       /* methods */
@@ -74,6 +77,4 @@
       bool quit;
 
-      /* main routine */
-      int run();
   };
 }
Index: code/branches/masterserver/src/orxonox/gamestates/CMakeLists.txt
===================================================================
--- code/branches/masterserver/src/orxonox/gamestates/CMakeLists.txt	(revision 7729)
+++ code/branches/masterserver/src/orxonox/gamestates/CMakeLists.txt	(revision 7730)
@@ -6,4 +6,5 @@
   GSRoot.cc
   GSServer.cc
+  GSMasterServer.cc
   GSStandalone.cc
 )
Index: code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.cc
===================================================================
--- code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.cc	(revision 7729)
+++ code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.cc	(revision 7730)
@@ -31,46 +31,37 @@
 
 #include "util/Debug.h"
-#include "core/CommandLineParser.h"
 #include "core/Game.h"
 #include "core/GameMode.h"
-#include "network/Server.h"
 
 namespace orxonox
 {
-    DeclareGameState(GSMasterServer, "masterserver", false, false);
+  DeclareGameState(GSMasterServer, "masterserver", false, false);
 
-    SetCommandLineArgument(port, 55566).shortcut("p").information("Network communication port to be used 0-65535 (default: 55566)");
+  GSMasterServer::GSMasterServer(const GameStateInfo& info)
+    : GameState(info)
+  {
 
-    GSMasterServer::GSMasterServer(const GameStateInfo& info)
-        : GameState(info)
-        , server_(0)
-    {
-    }
+  }
 
-    GSMasterServer::~GSMasterServer()
-    {
-    }
+  GSMasterServer::~GSMasterServer()
+  {
+    this->mserver->~MasterServer();
+  }
 
-    void GSMasterServer::activate()
-    {
-        GameMode::setIsServer(true);
+  void GSMasterServer::activate()
+  {
+    /* TODO make this work for masterserver as well */
+    //GameMode::setIsServer(true);
 
-        this->server_ = new Server(CommandLineParser::getValue("port"));
-        COUT(0) << "Loading scene in server mode" << std::endl;
+    this->mserver = new MasterServer();
+    COUT(0) << "Loading masterserver mode" << std::endl;
 
-        server_->open();
-    }
+    this->mserver->run();
+  }
 
-    void GSMasterServer::deactivate()
-    {
-        this->server_->close();
-        delete this->server_;
+  void GSMasterServer::deactivate()
+  { /* nothing so far */ }
 
-        GameMode::setIsServer(false);
-    }
-
-    void GSMasterServer::update(const Clock& time)
-    {
-        server_->update(time);
-    }
+  void GSMasterServer::update(const Clock& time)
+  { /* nothing so far */ }
 }
Index: code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.h
===================================================================
--- code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.h	(revision 7729)
+++ code/branches/masterserver/src/orxonox/gamestates/GSMasterServer.h	(revision 7730)
@@ -35,20 +35,23 @@
 #include "core/GameState.h"
 #include "network/NetworkPrereqs.h"
+#include "network/MasterServer.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport GSMasterServer : public GameState
-    {
+  class _OrxonoxExport GSMasterServer : public GameState
+  {
     public:
-        GSMasterServer(const GameStateInfo& info);
-        ~GSMasterServer();
+      GSMasterServer(const GameStateInfo& info);
+      ~GSMasterServer();
 
-        void activate();
-        void deactivate();
-        void update(const Clock& time);
+      void activate();
+      void deactivate();
+      void update(const Clock& time);
 
     private:
-        
-    };
+      MasterServer *mserver;
+
+
+  };
 }
 
