improved txt generation