loop over metadata instead