some small fixes to storage, and beginnings of overhaul of threads