added validation and analytics