added threadsafe back in