Some more thread safety work