Add functionality to getNextState
Rename of functions