Added save/restore functionality