Updated code to work with new versions of jQuery and jQueryUI