Sort references