start of histogram functionality
added count-by functionality