Fixed a lot of the Dijkstra's solution

Output is a lot better, and it can't go OOB now (but it can go down).