I think justice is served appropriately to most characters by the end of the play. Claudius, who killed his brother and then married that brother's wife, is killed by a combination of the "envenomed" point of Laertes's sword and the wine that Claudius himself poisoned to ensnare Hamlet. Gertrude, who was faithless and married her dead husband's brother just weeks after her husband's death, is poisoned by the wine prepared by her husband to murder her son. Laertes, whose father Polonius was slain by Hamlet and who conspired with Claudius against Hamlet and put poison on the tip of his sword in order to slay Hamlet (a rather dishonorable act), is killed by this very poison when he and Hamlet switch weapons during the fight. Hamlet eventually dies as a result of his injuries with this same poisoned weapon; he did delay his revenge on Claudius to the extent that other innocent people died in the meantime, including Rosencrantz and Guildenstern, Polonius, and Ophelia. Rosencrantz and Guildenstern were Hamlet's friends from university who became unwitting spies for Claudius. They had no evil intent. Polonius worked for Claudius but did not share his malice for Hamlet; he seemed genuinely concerned about the prince's well-being and mental health. Ophelia seems to have gotten caught in the crossfire between Hamlet and Claudius, and she did not deserve to die.