Updated node enumeration algorithm