Finished modifications for each proc to write its own output files. Still needs to be tested, but compiles correctly