Adding error catching to form submission