priority queue functions separated