Seperated file writing to another method called write_results(string target_file)