I removed the writing to the file from impwrite and create a new function imprecord. I migt go back and change this later due to ambiguity for others when learning how to use this... but for now, i do not care.