diff --git a/ov9/program1.py b/ov9/program1.py
index 280a398d87a65663d3712a450704a30d71c16597..37434f29fcc40e3658a6ff98d678a8537d09524e 100644
--- a/ov9/program1.py
+++ b/ov9/program1.py
@@ -75,19 +75,32 @@ def init_table():
     for i in range(num_of_nodes):
         res_arr.append(results(i, max_num.time+1, False, None))
 
-def rec_func(node, counter, global_fra):
-    counter += node.time
-    if node.node == global_fra:
-        return counter
-    else:
-        node = [a for a in res_arr if a.node == node.prev][0]
-        return rec_func(node, counter, global_fra)
+path=[]
+def rec_func(node, counter, global_fra, end_switch):
+    if not end_switch:
+        counter += node.time
+        if node.node == global_fra:
+            return counter
+        else:
+            node = [a for a in res_arr if a.node == node.prev][0]
+            return rec_func(node, counter, global_fra, end_switch)
+    elif end_switch:
+        counter += node.time
+        path.append(node.node)
+        if node.node == global_fra:
+            return counter, path
+        else:
+            node = [a for a in res_arr if a.node == node.prev][0]
+            return rec_func(node, counter, global_fra, end_switch)
+
+
 
 def calculate_shortest_path(current_node, time, current_neighbour, slutt):
+    end_switch = False
     count_a = 0
-    count_a = rec_func(current_neighbour, count_a, slutt)
+    count_a = rec_func(current_neighbour, count_a, slutt, end_switch)
     count_b = 0
-    count_b = rec_func(current_node, count_b, slutt)
+    count_b = rec_func(current_node, count_b, slutt, end_switch )
     count_b += time
     if count_b < count_a:
         return True
@@ -133,11 +146,12 @@ def dijkstras(slutt, fra, start):
                     current_neighbour.prev = tmp_edge.fra
     if we_soon_to_be_done and not len(end_que): 
         #not finished
-        print('ferdig, resultater er: node, tid, prev, besøkt')
-        for i in res_arr:
-            if i.time != max_num.time + 1:
-                print(i.node, i.time, i.prev, i.visited)
-        print('que when done is: ', queue)
+        end_node = [b for b in res_arr if b.node == slutt][0]
+        total_time = 0
+        end_switch = True 
+        total_time,travel_arr = rec_func(end_node, total_time, start, end_switch)
+        travel_arr = reversed(travel_arr)
+        print(f'total time: {total_time}\nshortest path: {"->".join(str(v) for v in travel_arr)}')
         exit()
     else:
         if we_soon_to_be_done: