PriorityQueue implementation