updated for histograms