refactor percentiles