Refactoring and Improving the captcha partial + js