Linted the code

Used JSLint to check the code