Tidy up the handling of jQuery.

Fixes #61