Rewriting the form and JS so it can submit