I've taken over this patch from Srinath, and added a preliminary refactoring patch to help address Jan's and my objections to the previous versions. Jan, Richard, does this look ok now? Alice