made lot of stuff thread safe