Checked in as branch bug-a57b6c3fd4 .  Looks good to me,
but another set of eyes before merge would be good too.