moved attachToFunction and clearFunctionEnv to tdodo