Added handling of deferreds