Fixed: speed improvements for gathering the histogram data