clean up source code (JSLint).
Moved capture here, becuase it uses jQuery.