making code jshint compliant (so lots of little changes) so that we can use jshint to easily detect any warnings or errors in the code