cleaned up dijkstra code; added test