Fix jshint warnings and trailing whitespace