Improve thread safety of data structures.