update the state of the code