Added implementation for priority queue.