Add code to write out the results