adding back and next state functionality