moved interval binning code to own class