Added writing to .txt file