OK, this is turning into more hassle than it's worth -- I think I've messed up too many things here.  I'm going to push a complete fresh patch with all feedback taken into account.