This should probably be separated into a function to read the file and one to write to the CIN.