A bit of a clean up of the histogram code