Basic sample sorting.