Improved the way `~/.prev_dir` is created