Updating the code to pass JSLint