This is the basic stuff for bug #8073.  The structure is in place, so we just need to do the actual work.