implemented countStateNodes() and adjustStateNodeCounts()