sort references.