Added rolling input state for testing determanistic state transitions.
Removed duplicated code.

Extracted the code from handling the remote client's message so that we could use it for both the server and the client.