Hannah Horvath is getting her act together. If she can.
 
Hannah, the twentysomething heroine of Girls (played by the show’s creator, writer and director Lena Dunham) spent much of the HBO comedy’s first season alienating every person in her life — including many of the viewers who didn’t see the appeal of a show built around a young narcissist fumbling her way through the world. By the season’s end, she had chased away her best friend Marnie (Allison Williams), her boyfriend Adam (Adam Driver) and was alone on the beach at Coney Island, with a piece of wedding cake her only companion. 
 
As we enter the second season (it debuts Sunday at 9), Hannah has gotten off the sand and attempted to break with bad old patterns. She’s in a new relationship with Sandy (Donald Glover from “Community”) and declares, "I'm going to make logical and responsible decisions when it comes to you." With Marnie moved out, Hannah is now living with gay ex-boyfriend Elijah (Andrew Rannells from “The New Normal”) and taking on airs of maturity and worldliness.
 
Of course, these airs tend to only betray her ignorance. — when Elijah says he wants to turn their party into a French salon, Hannah replies, "I've always felt I was secretly really good at cutting hair” — because what fun would “Girls” be if Hannah stopped being an epic screw-up?
 
The new episodes occasionally nod to some of last year’s criticism. Donald Glover seems there partially in response to the complaints that this was a very lily-white cross-section of Brooklyn — but also because Donald Glover is fantastic and fits seamlessly into this world — and in a marvelously uncomfortable scene in the second episode, he gets to give voice to the viewers who find Hannah (and her world) vacuous and narcissistic.
 
But there’s a difference between a character who’s oblivious and spoiled, and a show that is. And what continues to be clear about “Girls” is that it is incredibly smart and knowing — and, even more than last season, funny — in how it depicts the many ways that Hannah and friends inadvertently wind up hurting each other. 
 
Take Elijah, for instance. The performance Rannells is giving here isn’t too far removed from what he’s doing on “New Normal.” The difference is that “New Normal” doesn’t seem to realize that his character comes across as an obnoxious brat, while “Girls” not only knows it, but embraces it. The new season’s third episode has Hannah agreeing to use cocaine for the first time for a website writing assignment, with Elijah along for the ride. The episode starts out as farce, and an illustration of how Elijah’s presence encourages all of Hannah’s worst instincts, but like the best “Girls” installments, it’s capable of turning on a dime and getting to a great emotional truth about its characters.

The second season digs deeper into the relationship between Hannah’s fellow barista Ray (Alex Karpovsky) and her neurotic friend Shoshanna (Zosia Mamet) in a way that humanizes Shoshanna without taking away the raw comic energy Mamet brings to the role. The most pleasant surprise of last season was the role reversal between Adam and Hannah, where at first their relationship made her look bad for wanting to be around this disgusting oaf before our sympathies pivoted and we began to wonder why he was with her. Season 2 brings with it another shift, and an opportunity for Adam Driver to continue giving one of the more memorable, strange performances in all of TV comedy. And though the impulsive marriage of Hannah’s obnoxiously bohemian pal Jessa (Jemima Kirke) to a wealthy Wall Street type still feels slightly out of key with the rest of the series, it inspires a great set piece where she gets to meet her husband’s horrified parents, played by character actors Griffin Dunne and Deborah Rush.

But the drawing card remains Dunham, who’s only grown more confident as both a writer and actress. She’s more aware of what she can get away with having the characters say and do, but there’s even more vulnerability and more bite to her performance, as well as a greater willingness to go for physical comedy.
 
It takes an enormous amount of talent to make a show about a character this annoying be this watchable, and funny, and touching. Fortunately, Dunham has that kind of talent. “Girls” was one of the best shows on television last year, and based on the first four episodes, it has a good jump on the competition for 2013.
 
Alan Sepinwall may be reached at sepinwall@hitfix.com