implementing a priority queue