Fixed bug where wrong key was used for the priority queue -> total running time of the algorithm is now 3x faster