Finished implementing Dijkstra algorithm