Script now works per sample grouping