diff --git a/main.py b/main.py
index 4fa5a3a2838283aa72a030df1671f9a8b0fabd2a..988983b73c4af4297c3e4779ba215e16446cb2b4 100644
--- a/main.py
+++ b/main.py
@@ -16,7 +16,7 @@ from tools import *
 from world_ranking_list import get_world_ranking_html
 
 # Constants for Elo calculation
-K_FACTOR = 10
+K_FACTOR = 15
 INITIAL_ELO = 1500  # Starting Elo for all teams
 
 
@@ -467,6 +467,30 @@ class EloSystem:
                     dpi=100)
         plt.close()
 
+    def optimize_k(self):
+        self.load_and_process_csv_files()
+        error_history = []
+        for comp in self.competition_history:
+            if self.get_competition_name(comp) in ("DE", "EA", "AT", "NL", "AA", "ES", "UK", "IT", "CZ", "CH"):
+                if 2020 > self.get_competition_date(comp).year > 2016:
+                    results = self.competition_history[comp]['results']
+                    error = 0
+                    for result in results:
+                        error = error + abs(result[3] / K_FACTOR)
+                    error = error / len(results)
+                    error_history.append(error)
+                    pass
+        # calculate RMSE of the list of error
+        squared_errors = [error ** 2 for error in error_history]
+        mean_squared_error = sum(squared_errors) / len(squared_errors)
+        rmse = math.sqrt(mean_squared_error)
+
+        print(f"K of {K_FACTOR} results in a prediction RMSE of {rmse}")
+
+
+def run_optimize_k():
+    elo_system = EloSystem('csv_files', 'public/elo_website_combustion', "combustion")
+    elo_system.optimize_k()
 
 def main():
     """Main function to run the Elo ranking system"""