fix tests
add jshint to tests
make the code clean and tidy