add helper function for rebinning