This MR cherry-picks !852 (merged) onto testing, mainly so that the two branches are synchronised.
testing