added count Nodes function