added n_children function