Two Alabama cities lead the nation in several categories according to a study charting the best cities in which to buy a home based on the buyer’s occupation.

Both Huntsville and Mobile were singled out by PropertyShark, a blog covering real estate market trends, research reports, company and industry news.

Huntsville leads the nation among computer, engineering and science occupations, as well as management, while Mobile is tops in life, physical and social science occupations and healthcare practitioners and technical occupations.

PropertyShark’s method for choosing cities began with the median income of each occupation in every city, and how much money a buyer is left with after paying rent and living expenses. Taking total savings per month, they added the median home sale price in that city to find out the number of months one would need to save for a 20 percent down payment in each city. Then they divided the down payment amount with the monthly savings. Of course, saving for a down payment in smaller cities is easier.

For example, someone in healthcare in Mobile would need about 15 months to save enough for a 20 percent down payment, according to PropertyShark.

According to the site, “life, physical, and social science occupations are the best paying jobs for saving for a house in Mobile, AL. Due to the city being a regional center for medicine for the central Gulf Coast with more than 850 physicians, these three occupations—which are paired as one in Census—are the best option if you’re looking to save for a down payment.”

As far as Huntsville is concerned, PropertyShark stated that those in computer, engineering, and science occupations have a median income of $7,352. That means after paying all monthly expenses, they are left with $3,603. The city’s median home value is $170,000 in the city, meaning they would need about 10 months to save enough money for a house.

Birmingham also placed in the top 10 for architecture and engineering occupations, and the legal field. Mobile and Huntsville had other top 10 placements in those fields and others.

For a more complete breakdown, you can find the study here.