Major work, adding in getMetadata.