Follow CBSMIAMI.COM: Facebook | Twitter

NEY YORK (AP) – With a Mass for 18,000 people in a New York City arena, Pope Francis wrapped up a day that took him from the global spotlight of the United Nations to a classroom where he got impromptu coaching from a fourth-grader on using a touch screen.

READ MORE: Parkland first responder weighs in on Uvalde massacre: ‘It’s gut wrenching’

Before the service began, Francis made a lap of the arena floor in a golf cart, getting huge cheers.

He waved, smiled and accepted some flowers and other gifts. On a second lap that took him down the middle aisle, he stopped at one point, apparently to bless some children.

About 200 deacons and 150 volunteers assisted him in giving Holy Communion.

During the mass, Francis emphasized a point he has made throughout his U.S. trip: the need to welcome foreigners and marginalized people.

In his homily he also cited “children who go without schooling, those deprived without medical insurance, the homeless, the forgotten elderly.”

He says God “frees us from anonymity, from a life of emptiness and selfishness.” He also says, “God is living in our cities,” and so is the church.

He concluded the service with the customary “go in peace and serve the Lord” and added, “Please, I ask you, don’t forget to pray for me.”

READ MORE: Residents fed up with Biscayne Bay parties

Click here to view pictures of the pope’s visit in N.Y.C.

Pope Francis is leaving New York City for Philadelphia, on Saturday morning, with some evocative gifts from state and city leaders along with presents from many others.

Gov. Andrew Cuomo presented Francis with a special cross that was cut from steel salvaged from the World Trade Center.

Mayor Bill de Blasio gave the pontiff a New York City municipal ID card. The cards were designed to provide official government-issued photo identification for all city residents, especially those who have difficulty obtaining other forms of identification.

De Blasio says the cards are a “true symbol” of Francis’ message about protecting the most vulnerable.

Francis now joins more than 540,000 people who have the cards.

Click here for complete coverage of the pope’s visit.

MORE NEWS: 'Hidden Worlds': An immersive voyage into deepest oceans & mesmerizing mangroves through state-of-the-art technology

(© Copyright 2015 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)