added argument for output directory