updated submit function