Better calculation of node number