Basic implementation of priority queue