Made "state" a local variable

Allows you to store ANYTHING in the state value, even window controls,
and reduces data sent between server and client.