Finished refactoring for new metadata