Fixed a bunch of errors brought up by jshint