Buying a home is one of the largest transactions you’ll make in your lifetime. Because of this, it’s important to do it right. Here are ten guidelines you should follow when taking the plunge into homeownership.

1. Buy for the long run (at least five years).

Buying a home is a serious investment. Buy a home you want to live in, one that has the space and features you need. You don’t want to outgrow your home in a year or two. Keep your focus long-term.

2. Buy to improve your life.

Your home is where your life happens. It’s where you sleep, eat, host friends and family, and raise your children. Don’t buy simply because you think it will net a short-term financial return. You’ll probably spend several years of your life in the home you purchase, so you should make sure it meets your needs.

3. Focus on the important stuff.

Find a home you can afford that meets your needs. Don’t get distracted by fancy features that might tip you over your budget. Make a list of your basic needs, and stick to those requirements and values.

4. Stick to your budget.

Set your budget early. Almost 30% of buyers go over their budget. Why? Location. Urban buyers are much more likely to spend more than they intended. Location matters, but be realistic about your financial situation. Figure out if it’s worth the compromise and if you can actually afford it.

5. Put down 20% if you can.

When buying a house, a 20% down payment is ideal. Buyers who put down a smaller down payment pay a premium, usually in the form of private mortgage insurance (PMI). In addition, a higher down payment reduces your financial risk. You don’t want to owe more than your house is worth if the local market dips when you decide to sell.

6. Build up a six-month emergency fund.

It’s important to have a savings account that can cover six months of living expenses in case you get sick, lose your job, or face an unexpected expense. This will save you from financial hardship and give you peace of mind.

7. Get pre-approved.

Pre-approval shows sellers that you’re serious, reliable, and it helps you understand what you can afford. It might seem like a pain, but you won’t regret it.

8. Comparison shop to score the best mortgage.

Most buyers don’t shop around for a mortgage. However, the difference of half a percentage point in your mortgage rate can add up to thousands of dollars over time.

9. Spend no more than one third of your income (after tax) on housing.

This isn’t always possible if you live in a major city, but it’s still a good guideline to follow.

10. Always be willing to walk away.

If the sellers don’t accept your offer or the house doesn’t pass inspection, always be willing to walk away. Stick to your list of must-haves, stay on track with your budget, and don’t overreach or settle for something that isn’t right. You’ll find a good match when the timing is right.