Added more general metadata handling