Removed pythonic function and replaced with mongo map/reduce.
Minor adjustments to API to return proper format.