Tidy up test stuff a bit. Note that jshint fails epically, which we shall address some other time.