Added jshint & fixed some code