Increasing thread safety