Implemented form validation