Improve code style, make it pass JSLint