Change variable names
input -> inputName
output -> outputName

Add variables for file handles : inputFile, outputFile

Modify read and write to use saved file handles