added validations and required fields, moved error display to a helper method.