Adding thread safety