Fixed JSLint errors, third pass. Refactored code (variables).