Fix jshint warnings and remove trailing whitespace