I tested your code is very slow! Plus, my dictionary is sorted so there is no need to sort it again! Anyway to make it work in my scenario?