It probably needs a complete rewrite, but I've done what I can in the meantime. Maybe in the future we could have another hack at it? For now, thanks a lot for your invaluable help. I learned a lot about referencing from watching you.     