Thinking of a way to build a recursive state structure