Refactor the captcha service