added out, outDir, and reference