Tuned.
Fixed a crash.
Switched from locks to thread-local storage.