Added save/restore directory functions