rework the dirpersist/dirstack feature