“The world turned upside down” is not just a line from a “Hamilton” song, it describes how many Americans felt on Sunday, when the awful events in Orlando dominated the thoughts of the nation.

But the show must go on, and the Tony Awards acknowledged the tragedy in Florida in a variety of ways while also managing to do a respectful and lively job of celebrating the plays and musicals of Broadway. The show went about 15 minutes long, but when your big finish involves Barbra Streisand handing “Hamilton” the best musical trophy, well, that’s what you’d call going out strong.

You can’t say the broadcast didn’t put forth a good amount of effort at keeping viewers who may not have been as familiar with “Waitress” or “Shuffle Along.” Of course, the Tony Awards broadcast always has to serve a few different purposes: Promoting a variety of Broadway shows and honoring the work of a wide array of producers, performers and other theater professionals — and keeping a TV audience that may not have seen many (or any) of the shows from tuning out.

On top of all that, Sunday’s Tony Awards broadcast had to take into account the horrible tragedy in Orlando, and a lesser goal — one that was clearly a big priority before the Tonys were overtaken by the day’s events — consisted of promoting the rising star of CBS late-show host James Corden. There was also the small matter of keeping viewers engaged despite a lack of suspense regarding who would win most of the musical awards. “Hamilton” did, to no one’s surprise: a total of 11. But it’d be hard to find anyone who’d begrudge the wins of the runaway hit, whose cast opened the show with a rap celebrating Corden, did a big number in the third hour, and closed the show with the cast in street clothes singing the pop-driven party song “The Schuyler Sisters.”

“Hamilton’s” big Tony Awards number, “Yorktown,” was introduced in a pre-taped segment by President Obama and his wife, Michelle, and when Miranda won for original score, he was visibly moved as he read a sonnet he’d written. It captured much of the mood of the night: “When senseless acts of tragedy remind us/That nothing here is promised, not one day/The show is proof that history remembers/We lived through times when hate and fear seemed stronger/We rise and fall and light from dying embers/Remembrances that hope and love last longer/Love is love is love is love is love is love is love is love/It cannot be killed or swept aside.”

Corden was an energetic host, even if the opening number meant to showcase his lifelong love of theater felt as though it went on a little long. There was also the inevitable carpool karaoke number (featuring “Hamilton” creator and star Lin-Manuel Miranda). Corden was an affable host, and his opening remarks on Orlando — “Theater is a place where every race, creed, sexuality and gender is equal is embraced and is loved. Hate will never win, together we have to make sure of that” — were short but effective.

But as the host’s own father acknowledged, any three-hour awards ceremony starts to feel a bit long once it passes its midpoint. That said, the broadcast generally kept things moving smartly, and for every musical number on the main stage, there was a snippet of an energetic performance by a variety of Broadway casts on a stage outside the theater.

In the drama realm, the wide array of winners kept things up in the air, but every time the camera showed a nominee from another production in the musical realm, those men and women wore the slightly hangdog, bemused looks of people who were pretty sure they weren’t going to win.

That said, it wasn’t all “Hamilton” all the time. (Though who would have complained if it had been?) Celebrity wins like Jessica Lange for “A Long Day’s Journey Into Night” and big-name presenters like Oprah Winfrey, Chita Rivera and Claire Danes kept things relatively energetic. There were also tart, short and smart acceptance speeches from hard-working actors like Reed Birney, who won for his work in “The Humans,” which also had a big night. (Birney told his fellow actors, “I love sharing the planet with all of you.”)

And though the host of any awards show tends to fade out the longer a broadcast lasts, Corden snuck one very funny bit into the middle of the show: A tribute to the number of jobs that the long-running “Law & Order” franchise has provided to New York actors. Danny Burstein, the “Fiddler on the Roof” star, has apparently logged an impressive six different guest roles on the Dick Wolf family of shows.

Providing an exciting and much-deserved upset near the end of the broadcast, Leslie Odom, Jr., who plays Aaron Burr in “Hamilton,” won as best actor in a musical, beating out Miranda, who plays the title role. “I almost didn’t make it here. I almost fell, and every where I looked,” there was a fellow cast member to help him along, Odom said in his acceptance speech, which was, like his performance, full of quiet and unmistakable power. “Hamilton” is a show about “who lives, who dies, who tells your story,” and as the narrator of Hamilton’s journey, Odom is impressively versatile, giving Burr an insistent humanity and a charismatic complexity that made his Tony win quite moving.

Cynthia Erivo, who delivered a powerhouse performance during “The Color Purple’s” number, stopped the “Hamilton” train by winning as best actress in a musical, but that was another win the audience was very happy to applaud.

All in all, the Tony broadcast got the job done in terms of keeping Corden in the public consciousness — but more importantly, the cathartic nature of the musical numbers and a few of the speeches did the helpful, necessary work of channeling a day of difficult emotions.