Optimise for loops.
Correct JSLint errors.