Fixed most of the JSLint-reported errors.