Make thread safe (I think).