Initial 3-way merge from (5.001m, thr1m, 5.003) plus fixups.