Added validation for required fields