scripts used to calculate percentiles