Corrected placement of values in sorted array ('removes outliers from a data set')