Fix xref/mref indexing, meta data handling refactoring