add key and thread storage