improve thread storage design