trying to make haystack threadsafe - needs stress testing