Here’s a question every homeowner should ask: “What are the best ways to build home equity?”

Americans continue to see real estate, and building home equity, as the best long-term investment, but not everyone understands the best ways to build home equity.

Annual Gallup polls show that real estate, or building home equity, continues to beat out stocks, bonds, savings accounts and even the Great Recession-investment darling, gold, as the favored form of long-term investment.

Although the 35 percent of Americans who chose real estate in 2016 doesn’t match the pre-crash confidence Americans had in the housing market (a full 50 percent considered real estate the best long-term investment in 2002), it is up from its 2011 low, when just 19 percent thought real estate investing was a good idea.

This kind of surging confidence really begs the question: Have we learned anything from the housing crash?

One of the big takeaways from the crash was to avoid this exact line of thinking; that buying a house and building home equity is a safe and easy way to invest your money. Back during the heyday of the housing bubble, plenty of people were buying homes just to sell a few years later, taking advantage of all the tax-free money gained by exploding home prices.

But that doesn’t make for a sound investment strategy, and when the bubble burst, anyone caught up in that suddenly saw their home equity drain away. It became pretty clear pretty fast that treating your home as your primary investment was actually more risky and more difficult than many homeowners expected.

Now that the market is recovering, and home prices continue to rise—in fact home prices are just below the all time high set in April 2007, according to Zillow—the idea of seeing your home as an investment is becoming tempting once again.

Don’t get me wrong, looking at your home as an investment is smart. After all, for most of us, it’s our biggest asset and we’ll put more money into that than anything else over our lifetimes. But you have to look at it with a keen, educated eye, and keep these tips in mind to maximize your home’s potential as an investment and build home equity.

1. Be strategic about where you buy. You have to understand what’s going on in the neighborhood first. Sure, you want to buy in a place where the population and amenities are growing, but that only scratches the surface. You really have to think about who lives in the neighborhood, what kind of jobs they have and if their salaries and wages are growing. Home prices very closely mirror the income of the people who live there, so if you live in an area where everybody is a cop or teacher, at best home prices will go up about 1 percent a year. But if there’s a mixed and expanding job base where salaries are growing, home prices will follow.

2. Buy a home that is not in perfect condition. You need room to build value in the home through some minor renovations. So buy a home that needs some work, such as refinishing the floors, upgrading the kitchen or peeling off the ugly wallpaper. For the best return on investment, look for a home that needs a facelift, not a complete overhaul. That way you don’t have to put too much money into it to see a bigger boost in value.

3. Don’t buy the best house on the block. Just like you don’t want a house in perfect condition, you also don’t want to buy the best house in the area. You want some room for growth. Putting some good, old-fashioned elbow grease into it will boost the value much farther when you’re buying the smallest, ugliest house on the block rather than the biggest and best. All things being equal, your dollar goes further in the cruddy house.

4. Expect to stay put for at least five years. You probably won’t profit off a home without owning it for at least five years. It costs about 10 percent of the sales price to move, between the commission, closing costs and fees and the cost of the move itself, so your home value has to go up at least 10 percent just to break even. At a typical rate of inflation, that takes about 5 to 10 years to happen. The longer you stay, the more safety you have in your home investment.

Ilyce Glink is the Publisher of ThinkGlink.com and the Founder/CEO of Best Money Moves.