sample sorting and recording