Adding functionality to support writing out to a file.