make config threadsafe
add with method to dynamically change config