metadata cdv, cleaning and refactoring