new save/restor state implementation