Improved use of script when run from another directory