Use jQuery deferreds to coordinate callbacks