In 2016, Mostafa Kandil was working with Careem in Cairo, where he helped introduce the Dubai-based ride-hailing service to new markets. With nothing but a backpack, he dropped into cities from Istanbul to Hyderabad, no doubt a thrilling job for a 24-year-old.

His team frequently checked in with Careem’s CEO, Mudassir Sheikha, to assess results. “One of the key metrics we used to discuss was the average trip fare,” remembers Kandil. In the Middle East, on-demand transportation, in general, amounts to between $3 and $4 a ride.

Those fares are too expensive for many in poorer places— especially in Egypt, where the pound’s devaluation caused inflation to soar. Although public transportation in Cairo is cheap, it is poorly maintained. “The middle class in emerging markets is torn apart between the expensive on-demand transportation and the very cheap, very unreliable public transportation,” says Kandil.

He crafted a plan to combine the efficiency of a service like Careem with the pricing of public transportation, and quit his job in February 2017. With the help of longtime friends, Mahmoud Nouh and Ahmed Sabbah, he set out to develop an app connecting commuters to buses, called SWVL. “We’re trying to build our own version of public transportation, that’s smarter basically,” says Kandil, who’s now 25 and earned a spot on Forbes Middle East’s 30 under 30 ranking, along with Nouh and Sabbah.

Nouh oversees SWVL’s operations and Sabbah handles the tech, while Kandil is responsible for “everything else,” he quips. To build a network of drivers, he approached private tour operators who were eager to share a high-quality fleet of air-conditioned buses and vans that sat largely idle, as the country’s tourism industry stagnated.

To get tour operators to join, Kandil had to agree to pay drivers a guaranteed sum per ride, up to a certain amount, after which they would begin revenue sharing. Initially, those fixed costs prevented SWVL from enlisting a large network of drivers. Within 3 months, about 30 drivers signed up. Kandil and his co-founders kept two hours free in their schedules each day—in case a driver backed out last minute.

SWVL now has access to 300 buses and vans. Customers can schedule their pick-up and drop-off points on fixed routes at fixed times, and pay through the app or in cash. A 25-kilometer trip costs EGP35 ($1.98) versus EGP150 pounds ($8.49) for Careem or Uber. Tickets for public buses in Cairo start at EGP1.5-2.5 (8-14 cents). After accounting for fixed payments to drivers and revenue sharing, SWVL takes a 25% cut on average.

The service is currently available on 140 routes in Cairo and Alexandria. Kandil analyzes user search data to determine the most popular destinations. He says SWVL handles more than 10,000 rides per week, but there’s no getting around Cairo’s traffic. It can take 2 hours to complete a ride over 20 kilometers with SWVL; if it’s any consolation, customers can watch their ride on the app, as it makes its way through the snarl.

Through online advertising, Kandil has targeted tech-savvy millennials. To date, SWVL’s app has more than 300,000 downloads on Android and iOS. “We wanted young people to take SWVL,” says Kandil. “We wanted to be hipster, we wanted to be cool.” Customers are a mix of university students and corporate employees, who use it for daily commutes. A large portion of commuters are women, who want to avoid harassment on public transportation.

SWVL vets drivers through interviews and background checks, and trains them in customer service, including guidance aimed at preventing harassment.

Kandil was not the first on the scene. Buseet, founded in 2016, has the exact same service, and is expanding to Dubai. And looming on the horizon is a greater threat—Uber reportedly plans to launch its own bus service in Cairo within the near future. “We came into a pretty crowded and pretty dense space,” says Kandil. “The competition is fierce.” That’s led to a succession of failed companies over recent years, including Kartag and PieRide.

Meanwhile, the government hasn’t interfered with SWVL’s service yet, and Kandil hasn’t needed to get any permits so far. “They have been quite neutral to this,” he says. Still, in the past ride-sharing companies have faced potential bans in countries across the region.

Luckily, a powerful supporter enabled SWVL’s quick rise: Careem. Only four months after establishing SWVL, Kandil received $500,000 in seed funding from his former employer.

Kandil regularly posted updates on Facebook about his new company, which he thinks caught Sheikha’s attention. At the time, SWVL operated 10 routes in Cairo. Sheikha texted Kandil, asking to meet in Cairo. Until then, the founders had invested $30,000 of their own money in their startup, which they used to finance the company’s launch. Attempts to raise funding from VCs sometimes went poorly, largely due to their young age. “I remember in some meetings, some people were literally making fun of us,” says Kandil.

Not Sheikha or Careem’s co-founder Magnus Olsson. “The team has shown that they are capable of moving fast and iterating quickly, which is critical to finding the right product-market fit,” says Olsson, who sits on SWVL’s board. “Local ventures that truly cater to the particular needs of the local customer are bound to be successful.” Take that, Uber.

With the funds, Kandil was able to expand SWVL’s network of drivers, and add Alexandria. This year, he plans to expand into Karachi and Riyadh—big cities that have embraced on-demand ride-hailing, and have less than reliable public transportation.

Born and raised in Cairo, Kandil originally aspired to be a petroleum engineer, leading him to major in the field at the American University of Cairo, where he enrolled in 2009. While in college, he interned with the oil-field services company Schlumberger, which changed his thinking. He felt stifled and disliked the corporate lifestyle. “If I was absent for a day, I would not even be noticed,” says Kandil.

He began looking into other careers. In 2013, he participated in a month-long training program run by Google in Dublin, where participants learned about digital advertising. Back in Cairo, he took a break from his studies to apply for a position with Rocket Internet, the German company known for speedily building online startups in markets around the world.

Through Rocket’s Global Venture Development Management program, Kandil was assigned to help run an online classifieds marketplace for cars in the Philippines in 2014 along with two other employees. In six months, the startup hired 40 more employees and became the second largest online car marketplace in the country.

After finishing the program, Kandil returned to Egypt and graduated. He interned briefly with Procter & Gamble, and later with Sawari Ventures, a Cairo-based venture capital firm. In 2015, Kandil got another job through Rocket Internet, after the firm acquired Cairo-based online food ordering service Otlob. Kandil handled operations.

He left barely a year later to join Careem. “It was an opportunity I didn’t want to miss,” he says. Kandil helped Careem expand into eight cities in Egypt, Turkey and Pakistan. His team conducted legal research, made hires and set pricing. “It was super cool,” he says.

Still, the urge to start his own business became an “itch,” after he spotted an opportunity to disrupt public transport. He also wanted to move out of his comfort zone. “The longer I stay with any company, the more I get comfy,” says Kandil.

His primary school friends Nouh and Sabbah were on board. Nouh was then running a construction firm in Dubai and Sabbah was developing his own startup. “It was kind of a no brainer that we could always work together,” says Kandil. “We know what we like, what we don’t like.”

His experiences with Careem and Rocket Internet shaped him as an entrepreneur. He took cues from Rocket Internet’s intense focus on operational efficiency and maximizing productivity. For the first three months, SWVL’s co-founders were its only employees. They all pulled long hours, with Sabbah developing SWVL’s Android app in about two weeks.

Careem influenced Kandil’s approach to product development— always looking for new ways to automate and improve efficiency with technology. That’s helped SWVL with processes like scheduling drivers. They developed an automated system that assigns drivers to routes; if a driver cancels, the program plugs in somebody else—as long as it’s not the CEO. “Every step of the way we try to solve it with technology,” says Kandil.