added the current version of the binning algorithm.