refactor form submission logic to better handle asynchronous backend processes