Changed handling of metadata to dicts'