Sorts by frequency with keys alphabetically