code refactoring as per jslint.