actually working Dijkstra