wip
Last set of changes
final tweaks
add test and fix for threaded config leak