group_metadata function

Grouping metadata