added validation and callback