Implemented simple priority queue.