Updated submit event function