Added looping through $.Deferred until success