Rewrote pkgPath function.