Changed Dijkstra to Bellman-Ford where necessary and fixed typo.