optimist was not properly parsing "dir" so it was not getting the directory passed into the script, replaced "dir" with "d" arg