all work to generate a tree for the next state complete