refactored IP setting and new captcha handling