refactor captcha