Paying off your mortgage early may sound like a great idea, but it’s not always the wisest use of your money. Experts at say you should consider these four things before paying extra on your loan:

1. Pay off high-interest credit card debt: Continuing to pay high interest on credit cards just costs you money. Also, while mortgage interest is usually tax-deductible, credit card interest isn’t, so you’ll want to get rid of that first!

2. Build up your emergency fund: You need a financial cushion in case you lose your job or can’t work due to illness. Save up to three months of living expenses in a savings or money market account, and you won’t risk losing your home in case of an emergency.

3. Maximize matching retirement fund contributions: If your employer offers a company match on contributions to your 401(K), make sure you’re putting in enough to get the maximum amount matched. Otherwise, you’re just turning down free money.