added first part of dijkstra