made binned_sum, binned_sumsq and binned_tabulate generic functions