When the U.S.S. Voyager visits an outpost of the Mikhal Travellers, they meet a gypsy-like band of space explorers who are willing to share their knowledge of the territory the starship is about to enter. As Kes oversees the transfer of medical supplies to the group, she becomes infatuated with Zahir, a Mikhal pilot.
In the meantime, the Doctor is engaged in a new project: adding personality routines of famous historical figures, like Gandhi and Lord Byron, to his own program in order to enhance his performance. Torres expresses concern that the subroutines may interact unpredictably and offers to review his program.
As Kes grows increasingly fond of Zahir, the Doctor points out that she is neglecting her duties in Sickbay. Later, the Ocampan confides in Janeway that Zahir wants Kes to leave Voyager and travel with him. As she ponders her decision, Zahir is seriously injured by a mysterious cloaked figure.
The next day, a distraught Kes recounts Zahir's injuries to the Doctor. They're interrupted by Torres, who has found a potential problem with his program. Later, Tuvok and Janeway find Torres collapsed on the floor of Sickbay. The Doctor blames her condition on something she ate, but after Tuvok and Janeway leave, it becomes clear that he's the one who caused Torres' condition. The Doctor unsuccessfully tries to coerce her into removing his original "bland" personality from his blend of subroutines, which are rapidly destabilizing.
As Tuvok investigates the attack on Zahir, the Doctor kidnaps Kes. The discovery of residual holographic signatures near the attack site alerts the crew that the Doctor is the culprit. As the Doctor drags Kes along the mountain path where he assaulted Zahir, he's apprehended by Tuvok and Chakotay. Refusing to give up, he throws himself and Kes over a cliff. Voyager's transporter beams them up before they hit bottom, and Torres is able to delete the dangerous subroutines, which restores the Doctor to normal. Kes decides to remain on Voyager with her friends.