[Matt and I] Modified the algorithm to properly check for valid children to add