Clear timed-out cached captchas when the captcha is (re)loaded.
That will avoid showing an incorrect count of cached captchas.
Reorganize some captcha code.
Also a tiny fix.