tidying up code with jshint