Use a function for function for thread local wrapping

The class method variant is too error-prone.
Doc improvements