Add BachMetadata protocol and implementations && cleanup some warnings