Some moderate use of jQuery's deferred/promise stuff