refact code by jshint.