Added ability to set state properly and read properly. Also added log2 so that it can set the state to the server correctly