properly sorted z keys