refactored + generate new validate-[typename] fn