add actual implementation of percentile_disc_final