main.js: JSLint en refactored