added code for creating histograms