Gene therapy typically works by using vectors, most commonly viruses, to deliver the therapeutic gene to the patient's target cells. Once inside the cells, the new gene can produce functional proteins, correct genetic mutations, or make the diseased cells more recognizable to the immune system. There are two main types of gene therapy: ex vivo and in vivo. Ex vivo involves modifying the cells outside the body and then reintroducing them, while in vivo involves delivering the gene directly into the patient's body.