extend api to allow functions that returns a task in task array