tidy up form submission js