Add state saving