Generate new state logic