added validation to the form and callbacks