added binning ability code, need to integrate it.