Mortgage interest rates are rising. But it’s not too late to refinance your mortgage and hit a home run while you do it.

While interest rates aren’t quite at rock bottom, it’s still a great time to refinance. If you have the ability to refinance, do it. Even if you have already refinanced, if you can qualify for a mortgage rate that’s a percentage point lower than the one you have, you should consider refinancing again. The question is, what are the rules you need to follow in order to hit a home run when you do pull the refi trigger.

Start by talking to a handful of lenders to see if you qualify for refinance. Lenders will often look at your income-to-debt ratio, your home’s value, and your payment history when determining if they will refinance your mortgage. They’ll also pull your credit history and credit score (and if you don’t know what that number looks like, be sure to go to AnnualCreditReport.com and pay $9 for the score when you get a free copy of your credit report.)

Once you know what your credit report looks like, and you’ve started to identify mortgage lenders who can help, you can start planning your home run refinance. You should focus your refinance dollars on four key areas. A home run refinance needs to lower the interest rate, lower your payments, ideally reduce the length of the loan, and is one where you manage the costs of refinance. Depending on your personal circumstances, you may not be able to hit all four categories, but if you do, you’ll have a home run refinance for sure. Here’s a little more detail on how to make a home run refinance work for you:

1. Does your refinance lower the interest rate you’re paying?

Today’s interest rates are low, and chances are you can do better than the 11 percent, 7 percent, or even 5 percent interest rate you have now. Credit is a major factor in getting the lowest interest rates, so be sure to check your credit report and score before you start talking to lenders. If you’ve paid your mortgage on time and kept the rest of your finances in order, you may actually have a better credit score than you did years ago.

2. Does your refinance lower your monthly payments?

Ideally, you want to pay less each month, and there are two ways to do this. The best way is by lowering your interest rate. The other way is by extending your mortgage—but don’t do that. If you took out a 30-year mortgage initially, taking out another 30-year mortgage is a bad idea. While lowering your monthly payments will give you more breathing room, it’s not worth the extra cost you’ll pay over the long term.

3. Does it reduce the length of the loan?

If you can secure a low enough interest rate, you can reduce both the length (or term) of your loan and the cost of your monthly payments—and the savings can really add up. For example, if you took out a $250,000 refinance loan at 5 percent for 30 years, you’ll pay almost $230,000 in interest over the life of the loan. But shave five years off that same loan and you’ll save nearly $45,000.

4. Can you manage the costs of refinance?

If you’ve bought a house, then you know that there are plenty of costs associated with securing a mortgage. The same goes for refinancing. On top of administrative fees, your home must also be appraised, inspected, and assessed. You may have to pay a penalty for paying off your mortgage early, so be sure to check the details of your current mortgage agreement before moving forward with any plans. Make sure you can pay these costs off within six months to a year, and try to keep the costs to under $1,000.

This post was updated November 22, 2016