Updated the pattern matching
Added validation for the form