Rewrote algorithm for finding children's folds. It still doesn't work, but I think what I did before was fundamentally wrong.