Merge v2 branch back into master.

v1 has now been superseded