Add some thread safety crap up in here.