partial progress toward making it thread safe