Refactor captcha