Refactoring for expand_chroot_path and narrow_chroot_path macros