Update to the working dijkstra.