priority queue idea works