change deprecated .getchildren() calls to use iteration