priority queue now works properly