priority queue seems to work