restoring test that was removed during debugging
Improving performance with better list operations

pop() and extend are faster than pop(0) and prepending.

making each node remember its index in the parent's _children
array is a pain from the standpoint of more bookkeeping, but
removes an O(n) operation in replace_child.