dijkstras: working, but inefficient