Implement --outdir and use same filename for input and output