Indirect sorting and various sorting utilities.