new routine for binning the data.