Adding GetNextState

GetNextState provides the next state from a given state and step.