updated to write summary data to txt file