rewriting using JSLint