aggr_metadata function

Aggregate metadata