Lots of small tweaks to pass jshint.