A few minor improvements

I converted one var to a val, and I adjusted the output directory and file name so permissions errors would not be enountered