Minor improvement to zscore algo