Implemented the enqueuing on the priority queue.