As he traveled through Baltimore to promote his jobs agenda on Friday, President Barack Obama found himself sitting near a 29-year-old man who was uncertain how to reset his life after being released from prison two years ago.

In one of the few spontaneous moments of the president's visit, Marcus Dixon — father of two boys — told Obama how he connected in 2011 with a workforce development group called the Center for Urban Families, put his life back together and began studying to become a pharmacist.

"I grew up without a father," the president reminded Dixon. "For your sons to see you taking this path, that's going to make all the difference in the world."

Besieged by scandals in Washington, Obama swung through Baltimore in an effort to draw attention to his economic policies — including efforts to boost manufacturing and infrastructure, support early childhood education and promote training programs such as the one that helped Dixon.

But the trip was overshadowed by the string of controversies — particularly revelations that the Internal Revenue Service applied added scrutiny to conservative groups — that have put the White House on the defensive.

The ousted head of the IRS, Steven Miller, was grilled Friday during a hearing on Capitol Hill that dominated the news.

Other than renewing a call to speed federal approval of major infrastructure projects, the president offered no new concrete ideas to aid the nation's economic recovery. He sat in on a pre-kindergarten class at Moravia Park Elementary School, toured a company that makes dredging equipment in the Carroll-Camden Industrial Area and met with Dixon and leaders of the Center for Urban Families.

"The truth is there are a lot of reasons to be optimistic about where this country is headed," Obama told about 800 people gathered at Ellicott Dredges, a 128-year-old company that exports dredging equipment around the world.

"I know it can seem frustrating sometimes when it seems like Washington's priorities aren't the same as your priorities," he said. "But the middle class will always be my No. 1 focus, period. Your jobs, your families, your communities — that's why I ran for president."

Republicans dismissed Obama's trip, arguing it was more about politics than pocketbooks, and tweaked the administration for a second day about the Keystone XL pipeline.

The head of Ellicott Dredges went to Capitol Hill on Thursday, the eve of Obama's visit, to testify in support of the pipeline. The project divides Democrats; the White House has delayed a decision on whether to approve it.

"It's been a tough week for the president," said Diana Waterman, chair of the Maryland Republican Party. "It's only natural that he might want to get out of D.C."

Rep. Andy Harris, a Baltimore County Republican, described the visit as "another photo op on a campaign-style tour." He said that "the president talks a good game but … he never walks the walk."

Obama's visit came at the end of a week in which the White House juggled several controversies. In addition to the IRS imbroglio, the administration is facing criticism for how it handled last year's attack on the diplomatic post in Benghazi as well as news that the Justice Department had secretly obtained phone records of Associated Press reporters.

He did not mention any of those issues Friday.

The president's helicopter landed in Northeast Baltimore shortly before noon, marking the first time Obama had visited the city since attending fundraisers last June. His motorcade zipped through town, closing roads and occasionally snarling traffic. Some residents stood along the route, snapping pictures on camera phones as the convoy of vehicles sped by.

His first stop was Moravia Park Elementary School, where 30 pre-kindergarten students were learning about animals. The children are enrolled in an early childhood education program run by the Judy Center, and the administration has been eager to promote an increase in federal spending on pre-K education.

"I just came by to say 'hi' because I hear you guys are doing all kinds of great work here," Obama, his sleeves rolled up, told the 4- and 5-year-olds as he strolled into the school's library. "So, what kinds of things have you been learning in school?"

"About animals," one student yelled.

Obama quizzed some of the children on arithmetic before taking a seat to watch the lesson.

He then toured Ellicott Dredges, stopping several times to chat with employees about how the systems are made. The company, which also has offices overseas, is a major exporter.

Shortly after the tour, Obama addressed a large group of supporters that included Gov. Martin O'Malley, Baltimore Mayor Stephanie Rawlings-Blake and members of the state's congressional delegation.

The Center for Urban Families was the final stop of the visit. The program, which was founded in 1999, works to connect fathers with stable employment.

"It restored my dignity," Dixon told Obama. "One of the greatest things they taught me was not to have a poor mind-set."

Rep. Steny Hoyer, the House minority whip, accompanied Obama at each of his stops. Hoyer has pressed for years for a renewed emphasis on domestic manufacturing. And the early childhood center the president toured is part of a program named after Hoyer's late wife, Judith P. Hoyer.

"He accomplished what he wanted to accomplish, and that is to focus on jobs and opportunity and middle-class improvement," the Southern Maryland Democrat said. "And he was critical, of course, of an agenda in Washington that is anything but that."