JS refactoring accordingly JS.lint and JS.hint recommendations