Updated A* with a sorting list, essentially a priority queue.