refactor histogram to reduce code duplication
fix balance functions

They have been calculated incorrectly. The charge-only balance function
still does not look right.
choose slightly small bin size for balance functions