Added histogram calculation

There's still a bug in the fast accumulative histogram calculation, so a slower version is being used for now.  This will be fixed in a few weeks.