deferred db connection close
added func to extract histogram from view result

If reduce has been applied to the view,
histogram is already included in the view results.

Therefore, we can extract histogram directly without calculation.
applied customized int type conversion
spacing and todo
used reducers for contact charts

- obvious performance gain observed here