Add code for writing temporary results to a file