adding median binning