Changed variable declarations, refactoring for JSLint.