Use jQuery.Deferred to avoid callback nesting