Added file-writing to example