update binning function