task function updated to accept callbacks of varargs.