Remove trailing whitespace and fix minor jshint issues