Basic priority queue implementation