Fixed up the script so the working directory isn't changed, but is still flexible.