update to use rscript argument to make cwd parameter flexible