Changed z-score thresholding to be in terms of std. deviation