Added support for thread based variables.