added statistical outlier removal function