diff --git a/DataAnalyser.py b/DataAnalyser.py
index 2a2af99b02c46ee2f8931a2bfb99fe304370fdaf..63a244b26d21a3f90a4bed76f0e9ff056b19b27c 100644
--- a/DataAnalyser.py
+++ b/DataAnalyser.py
@@ -19,8 +19,6 @@ class DataAnalyser(DataHandler):
         return overtakesInRaces
 
     def analyseRaceForOvertakes(self, race: Session):
-
-
         # Collect grid positions
         allLapPositions: List[dict[str, int]] = []
 
@@ -46,10 +44,11 @@ class DataAnalyser(DataHandler):
 
         if self.activateDebugOvertakeAnalysis:
             print(f"\nLap: 0")
-            for position in range(len(gridPositions)):
+            for i in range(len(gridPositions)):
+                position: int = i + 1
                 gridPositions.values()
-                driverAtPosition = list(gridPositions.keys())[list(gridPositions.values()).index(position + 1)] # get dictionary keys (driverIds) by values (current race position)
-                print(f"P{position + 1}: {driverAtPosition}")
+                driverAtPosition = self.getDriverByPositionFromMap(gridPositions, position)
+                print(f"P{position}: {driverAtPosition}")
 
         return gridPositions
 
@@ -75,10 +74,11 @@ class DataAnalyser(DataHandler):
             for raceLapIndex in range(race.total_laps):
                 print(f"\nLap: {raceLapIndex + 1}")
                 runningLapPositions = runningLapsPositions[raceLapIndex]
-                for position in range(len(runningLapPositions)):
+                for i in range(len(runningLapPositions)):
                     runningLapPositions.values()
-                    driverAtPosition = list(runningLapPositions.keys())[list(runningLapPositions.values()).index(position + 1)]
-                    print(f"P{position + 1}: {driverAtPosition}")
+                    position: int = i + 1
+                    driverAtPosition = self.getDriverByPositionFromMap(runningLapPositions, position)
+                    print(f"P{position}: {driverAtPosition}")
 
         return runningLapsPositions
 
@@ -110,20 +110,30 @@ class DataAnalyser(DataHandler):
                 #print(orderToSort[i])
 
 
-
         overtakes: int = 0
-        index: int = 0
-        while index < len(orderToSort) - 1:
-            if orderToSort[index] > orderToSort[index + 1]:
-                temp: int = orderToSort[index]
-                orderToSort[index] = orderToSort[index + 1]
-                orderToSort[index + 1] = temp
+        i: int = 0
+        while i < len(orderToSort) - 1:
+            if self.countOutPitstops:
+                driverPittedThisLap: bool = False
+                currentDriversEndPosition = orderToSort[i]
+                driver = self.getDriverByPositionFromMap(endOrder, currentDriversEndPosition)
+
+
+            if orderToSort[i] > orderToSort[i + 1]:
+                temp: int = orderToSort[i]
+                orderToSort[i] = orderToSort[i + 1]
+                orderToSort[i + 1] = temp
                 overtakes += 1
-                index = -1
-            index += 1
+                i = -1
+            i += 1
 
         return overtakes
 
+    def getDriverByPositionFromMap(self, positions: dict[str, int], position: int):
+        driver = list(positions.keys())[list(positions.values()).index(position)]
+        return driver
+
+
     # ===== Weather =====
 
     def analyseRacesForWeather(self, races: List[Session]):
@@ -183,6 +193,8 @@ class DataAnalyser(DataHandler):
             if noStartingCompoundsLeft: return currentLap
             currentLap += 1
 
+        return -1 # no lap without compound found; all laps use same compound type
+
 
     def getCompoundsForRace(self, race: Session):
         compoundsPerLap: List[List[str]] = [[]]
@@ -225,6 +237,7 @@ class DataAnalyser(DataHandler):
                 if compound not in filter:
                     return currentLap
             currentLap += 1
+        return -1 # no lap with opposite compound found; all laps use same compound type
 
     def setFilter(self, startingCompound: str):
         if startingCompound == 'SLICK': return self.slickCompounds
diff --git a/DataHandler.py b/DataHandler.py
index c718a439337e95e47d859e77b70da8cc75129b50..c62cc6f71489986b6fb624f1c696be8e64eadccb 100644
--- a/DataHandler.py
+++ b/DataHandler.py
@@ -7,4 +7,5 @@ class DataHandler(ABC):
         self.invalidDriverId = "NO_DRIVER"
         self.enableTestingMode = False  # only partially import data to speed up testing, because HTTP 429 limits import speed
         self.activateDebugOvertakeAnalysis = False
-        self.slickCompounds = ('SOFT', 'MEDIUM', 'HARD')
\ No newline at end of file
+        self.slickCompounds = ('SOFT', 'MEDIUM', 'HARD')
+        self.countOutPitstops = True
\ No newline at end of file