Updated to write to file.