updated to output histograms