clean up submit code