Remove two unnecessary args from function, add default for wd
Modify file writing to use specified location of wd