added rebinning codes