binning algo improvements