updated to use quantile and group-wise probs value for quantile function