Adaptive histogram bin width

And removed dead code