Extract TLS to library.

Closes #20.