Keys will not necessarily be sorted so sort them