working on state save