add jshint validation, refactor existing code by rules