Converted queue into a generalized priority queue.