Commits that went missing

These are the four commits that I created after the initial pull request for thread-safety and which somehow went missing. There are no additional changes to what has already been reviewed.