removed 'this.endTask();' requirement in deferredFunction