More docs
Refactor thread local stuff into own module