Histogram refactoring: v1