Histogram improvements

This patchset is from @rpruim, and committed by me.