Thanks, I pushed the attached slightly-simpler patch.