refactored how metadata and validation works