Use SortedMap as priority queue