implemented sending of updates of state to server.