updated with djikstras'