Fixing up javascript problems from jshint