Simplify TLS code