changes for saving state