Infinite loop first try at Dijkstra's