improve and simplify captcha/submit code