Create functions for generating histograms

* Right now the indexing logic is wrong, though