cleanups to input file, more things saved to output