made directoryservicces mostly thread safe