corrected priority queue