Better way to determine number of nodes passed