Refactor Javascript to JSLint