Index: code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc	(revision 10719)
+++ code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc	(revision 10722)
@@ -42,4 +42,9 @@
         return false;
     }
+    bool CommonController::hasWingman()
+    {
+        return true;
+    }
+
     CommonController::CommonController(Context* context) : Controller(context)
     {
Index: code/branches/AI_HS15/src/orxonox/controllers/CommonController.h
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/CommonController.h	(revision 10719)
+++ code/branches/AI_HS15/src/orxonox/controllers/CommonController.h	(revision 10722)
@@ -44,5 +44,8 @@
             virtual bool isLeader();
             virtual bool setWingman(CommonController* wingman);
+            virtual bool hasWingman();
+            CommonController* myWingman_;
 
+            CommonController* myLeader_;
 
         protected:
Index: code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc	(revision 10719)
+++ code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc	(revision 10722)
@@ -45,9 +45,12 @@
         if (this->isInitialized())
         {
-           
+            if (this->myFollower_)
+                this->myFollower_->myDivisionLeader_ = 0;
+            if (this->myWingman_)
+                this->myWingman_->myLeader_ = 0;
         }
     } void DivisionController::tick(float dt)
     {
-                SUPER(DivisionController, tick, dt);
+        SUPER(DivisionController, tick, dt);
 
     }
Index: code/branches/AI_HS15/src/orxonox/controllers/DivisionController.h
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/DivisionController.h	(revision 10719)
+++ code/branches/AI_HS15/src/orxonox/controllers/DivisionController.h	(revision 10722)
@@ -65,7 +65,22 @@
                 }
             };
+            virtual bool hasWingman()
+            {
+                if (this->myWingman_)
+                    return true;
+                else
+                    return false;
+            }
+            virtual bool hasFollower()
+            {
+                if (this->myFollower_)
+                    return true;
+                else
+                    return false;
+            };
+            
+
             virtual void tick(float dt); //<! Carrying out the targets set in action().
 
-			
 
         protected:
@@ -79,6 +94,5 @@
 			FormationMode formationMode_;
 			
-			CommonController* myWingman_;
-      		LeaderController* myFollower_;
+			
 	        
 
Index: code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc	(revision 10719)
+++ code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc	(revision 10722)
@@ -41,6 +41,6 @@
         this->gameGoal_ = DOMINATE;
         this->goalPosition_ = NULL;
-        this->goalTarget_ = NULL;
-        this->goalProtect_ = NULL;
+      /*  this->goalTarget_ = NULL;
+        this->goalProtect_ = NULL;*/
         this->nTicks_ = 0;
         this->bTicked_ = false;
Index: code/branches/AI_HS15/src/orxonox/controllers/FleetController.h
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/FleetController.h	(revision 10719)
+++ code/branches/AI_HS15/src/orxonox/controllers/FleetController.h	(revision 10722)
@@ -48,8 +48,4 @@
 
 #include "worldentities/ControllableEntity.h"
-#include "worldentities/pawns/SpaceShip.h"
-#include "worldentities/pawns/Pawn.h"
-#include "worldentities/pawns/TeamBaseMatchBase.h"
-
 
 
Index: code/branches/AI_HS15/src/orxonox/controllers/LeaderController.h
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/LeaderController.h	(revision 10719)
+++ code/branches/AI_HS15/src/orxonox/controllers/LeaderController.h	(revision 10722)
@@ -49,5 +49,5 @@
             {
                 return true;
-            }
+            };
             bool bIsDivisionLeader_;
             virtual bool setFollower(LeaderController* myFollower)
@@ -55,4 +55,14 @@
                 return false;
             };
+            virtual bool bIsDivisionLeader()
+            {
+                return bIsDivisionLeader_;
+            };
+            virtual bool hasFollower()
+            {
+                return true;
+            };
+            LeaderController* myFollower_;
+            LeaderController* myDivisionLeader_;
 
 
Index: code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc	(revision 10719)
+++ code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc	(revision 10722)
@@ -48,18 +48,25 @@
         if (this->isInitialized())
         {
-           
+            if (this->myDivisionLeader_)
+                this->myDivisionLeader_->myFollower_ = 0;
+            if(this->myWingman_)
+                this->myWingman_->myLeader_ = 0;
         }
     }
-     LeaderController* SectionController::findNewDivisionLeader()
+   
+    LeaderController* SectionController::findNewDivisionLeader()
     {
 
         if (!this->getControllableEntity())
-            return NULL;
+            return 0;
 
-        
+        LeaderController* closestLeader = 0;
+        float minDistance =  std::numeric_limits<float>::infinity();
         //go through all pawns
         for (ObjectList<LeaderController>::iterator it = ObjectList<LeaderController>::begin(); it; ++it)
         {
-
+            //0ptr or not DivisionController?
+            if (!(it) || !(it)->bIsDivisionLeader_ || !(it->getControllableEntity()))
+                continue;
             //same team?
             if ((this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam()))
@@ -72,11 +79,14 @@
 
             
-            //nullptr or not DivisionController?
-            if (!(it) || !(it)->bIsDivisionLeader_)
-                continue;
+           
 
             float distance = ((it)->getControllableEntity()->getPosition() - this->getControllableEntity()->getPosition()).length();
-
-            // is pawn in range?
+            
+            if (distance < minDistance && !(it->hasFollower()))
+            {
+                closestLeader = *it;
+                minDistance = distance;
+            }
+           /* // is pawn in range?
             if (distance < RADIUS_TO_SEARCH_FOR_LEADER)
             {
@@ -84,7 +94,12 @@
                 if ((it)->setFollower(this))
                     return (*it);
-            }
+            }*/
         }
-                return NULL;
+        if (closestLeader)
+        {
+            if (closestLeader->setFollower(this))
+                return closestLeader;
+        }
+        return 0;
 
     }
@@ -96,9 +111,9 @@
         {
             LeaderController* newDivisionLeader = findNewDivisionLeader();
-            myDivisionLeader_ = newDivisionLeader;
-           /* if (newDivisionLeader)
+            this->myDivisionLeader_ = newDivisionLeader;
+            /*if (newDivisionLeader)
                 orxout(internal_error) << "new DivisionLeader set" << endl;
             else
-                orxout(internal_error) << "null division leader" << endl;*/
+                orxout(internal_error) << "0 division leader" << endl;*/
         }
     }
Index: code/branches/AI_HS15/src/orxonox/controllers/SectionController.h
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/SectionController.h	(revision 10719)
+++ code/branches/AI_HS15/src/orxonox/controllers/SectionController.h	(revision 10722)
@@ -54,10 +54,16 @@
                 }
             };
+            virtual bool hasWingman()
+            {
+                if (this->myWingman_)
+                    return true;
+                else
+                    return false;
+            }
+
             virtual void tick(float dt); //<! Carrying out the targets set in action().
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
             LeaderController* findNewDivisionLeader();
- 
-
 
         protected:
@@ -76,6 +82,5 @@
         private:
             Timer actionTimer_; //<! Regularly calls action().
-            CommonController* myWingman_;
-            LeaderController* myDivisionLeader_;
+            
             Vector3* desiredRelativePosition_;
 
Index: code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc	(revision 10719)
+++ code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc	(revision 10722)
@@ -29,11 +29,4 @@
 #include "WingmanController.h"
 
-#include "core/CoreIncludes.h"
-
-#include "core/XMLPort.h"
-#include "core/command/ConsoleCommandIncludes.h"
-
-#include "worldentities/ControllableEntity.h"
-#include "worldentities/pawns/Pawn.h"
 
 namespace orxonox
@@ -51,25 +44,24 @@
     WingmanController::~WingmanController()
     {
-    }
-
-   /* void WingmanController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(WingmanController, XMLPort, xmlelement, mode);
-
-        XMLPortParam(WingmanController, "accuracy", setAccuracy, getAccuracy, xmlelement, mode).defaultValues(100.0f);
-        XMLPortObject(WingmanController, WorldEntity, "waypoints", addWaypoint, getWaypoint,  xmlelement, mode);
-    }*/
+        if (this->myLeader_)
+            this->myLeader_->myWingman_ = 0;
+    }
+
     CommonController* WingmanController::findNewLeader()
     {
 
         if (!this->getControllableEntity())
-            return NULL;
-
-        
-        //go through all pawns
+            return 0;
+
+        CommonController* closestLeader = 0;
+        float minDistance =  std::numeric_limits<float>::infinity();
+
         for (ObjectList<CommonController>::iterator it = ObjectList<CommonController>::begin(); it; ++it)
         {
+            //0ptr?
+            if (!it || !it->isLeader() || !(it->getControllableEntity()))
+                continue;
             //same team?
-            if ((this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam()))
+            if (this->getControllableEntity()->getTeam() != (it)->getControllableEntity()->getTeam())
                 continue;
             //is equal to this?
@@ -79,11 +71,13 @@
 
 
-            //nullptr?
-            if (!it || !it->isLeader())
-                continue;
+          
 
             float distance = (it->getControllableEntity()->getPosition() - this->getControllableEntity()->getPosition()).length();
-
-            // is pawn in range?
+            if (distance < minDistance && !(it->hasWingman()))
+            {
+                closestLeader = *it;
+                minDistance = distance;
+            }
+            /*// is pawn in range?
             if (distance < RADIUS_TO_SEARCH_FOR_LEADER)
             {
@@ -91,23 +85,30 @@
                 if (it->setWingman(this))
                     return *it;
-            }
-        }
-        return NULL;
-    }
+            }*/
+        }
+        if (closestLeader)
+        {
+            if (closestLeader->setWingman(this))
+                return closestLeader;
+        }
+        return 0;
+    }
+    
     void WingmanController::action()
     {
         //this->target_ = this->sectionTarget_;
-        if (!myLeader_)
+        if (!this->myLeader_)
         {
             CommonController* newLeader = findNewLeader();
-            myLeader_ = newLeader;
-           /* if (newLeader)
+            this->myLeader_ = newLeader;
+            if (newLeader)
                 orxout(internal_error) << "new Leader set" << endl;
             else
-                orxout(internal_error) << "null leader" << endl;
-*/
+                orxout(internal_error) << "0 leader" << endl;
+
         }
         else
         {
+
             //orxout(internal_error) << "already have a Leader" << endl;
 
Index: code/branches/AI_HS15/src/orxonox/controllers/WingmanController.h
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/WingmanController.h	(revision 10719)
+++ code/branches/AI_HS15/src/orxonox/controllers/WingmanController.h	(revision 10722)
@@ -32,4 +32,5 @@
 
 #include "controllers/CommonController.h"
+#include <limits>
 
 
@@ -50,4 +51,5 @@
                 return false;
             };
+
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
             virtual void tick(float dt); //<! Carrying out the targets set in action().
@@ -65,5 +67,4 @@
             
             WeakPtr<Pawn> target_;
-            CommonController* myLeader_;
             //LeaderController* leader_;
 
