There are several conflicts, problems, and misunderstandings that need to cleared up by the end of Shakespeare's Twelfth Night. The best way to give an account of those problems that need to be solved would be to associate them with the names of those who are the victims, or receivers of the misunderstanding. There are two men who are held prisoner because of misunderstandings: Antonio and Malvolio. Antonio was taken as an enemy to the Duke, but when he asked for his money back and help from Cesario, (thinking he was Sebastian),he was detained. Malvolio's release from a darkened room is approved once his letter to Olivia is delivered and he is allowed to speak for himself. Antonio, on the other hand, needed to wait until both Viola and Sebastian were together in front of everyone before that confusion could be figured out. Once Sebastian claimed Antonio as a friend, it was only then that he could be released. When people are able to communicate openly, so much can be resolved.
The next thing that needed to be resolved is the identity of Cesario and Sebastian--along with who loves whom. Once explanations of the "twins" were divulged, then misdirected love could be redirected and righted. Sebastian stays with Olivia and Viola is able to claim the Duke since she loves him and is also of noble birth. It also helps Olivia to avoid the Duke's persistence of her to be able to declare and prove by priestly witness that she married Sebastian in Act IV. At the end of most of Shakespeare's comedies, lies and misunderstandings are cleared up and all leave satisfied with the resolution and happy.