some optimisations in metadata discovery