It took me a while to figure out how I could count the ancestors and descendants properly. I was hoping I would figure out an algorithm that would not require a manual search of the ancestor and descendant tree for every individual. Unfortunately, as it turns out that is exactly what you have to do. There are no shortcuts.
So I developed a couple of recursive routines (ones that call themselves over and over until the path is traversed) to do the counting and thus modified my CountAncestorsAndDescendants routine. In so doing, I found I could merge in the counting work needed to be done by the AutoOrganize routine. Running some tests, I was a pleasantly surprised to find that this brute force method of counting does not seem to take a noticeable amount of time compared everything else that Behold has to calculate. That is good!
Finally, I have to mark people as visited when counting so that they are not double counted. And if I return to the starting person, then that person is his/her own ancestor and you have a strange loop that a message should be given for, as this is a scenario that might only occur in a science fiction soap opera where a person goes back in time and becomes his own grandfather. This may be desired by someone (and will be allowed in Behold with a warning), but more than likely the person made a data or linking error and will want to be informed about it.