Result function now writes experiment data to file.