Add grouping hash

Could you consider to merge this?
If we should use "grouping_hash" instead of "group_key" as the variable name, I will fix it.