cleaned up sorting algorithm,added stdev as criteria and QC information to output plots