def update_txt_docx(pt_txt, pt_docx_list, p, clean, print_p_by_p=False):
    """
    This function is a factor function called by epilepsy_docx.
    
    1. pt_txt and pt_docx_list are updated paragraph by paragraph.
    2. p is the paragraph contents from docx Document class.
    3. clean option strips the text
    4. print_p_by_p is an option to print out the text as it is being read.
    
    """
    
    pt_txt = pt_txt + '\n' + p.text
    pt_docx_list.append(p.text)
    
    if print_p_by_p:
        print(p.text)

    if clean:
        pt_txt = pt_txt.strip()

    return pt_txt, pt_docx_list