Modified for dictionary sort