more changes for losing CriticalSection class