beginning Submit function