Improved thread safety