Remove rootList only after iteration is done.