Fixed the for loop and added a new method for limiting the number of children found