Refactor metadata into separate metadata section, fix issue with inconsistent Collection class selection