Refactor code to pass jshint

code refactor to pass jshint