Added save/restore of user state