also changed to output txt file