Write all input/output files correctly