working on sample sorting