some more next state logic