This reverts commit 5db9250231. Further to the early revert, the sanitizers have found something wrong with this.
5db9250231