Metadata processing and generation code