Updated SXT algorithm to use a priority queue.