first suggestion for the setNextState api change