Moving percentile calcs to use the frequencies structure