Made it run. Add jshint
Added some fixes suggested by jslint