improved rebinning