Better implementation of task-fn/TFn