Metadata indexing refactoring for #5