Fix pop logic

I'm a little confused about the difference between child_index and child. Not a big deal but you could probably get away with a single identifier.