priority queue now checks for duplicates.