added validation and relations