Improved the performance of the group by map reduce. Still some fixes
needed