
366 N.W.2d 843 (1985)
Donald BOOTH and Martha Booth, Plaintiffs and Appellants,
v.
George CHAMALES and Mary Chamales, Defendants and Appellees.
No. 14683.
Supreme Court of South Dakota.
Considered on Briefs March 6, 1985.
Decided April 24, 1985.
Charles Poches, Jr. of Poches & Lee, Ft. Pierre, for plaintiffs and appellants.
Max A. Gors of Gors, Braun & Carlon, Pierre, for defendants and appellees.
WUEST, Acting Justice.
Appellants Donald and Martha Booth (Booths) appeal from a judgment denying foreclosure on an executory contract and denial of attorney fees. We affirm the denial of foreclosure, reverse on the denial of attorney fees, and remand to the trial court to exercise its discretion on attorney fees, pursuant to SDCL 21-50-4.
On July 1, 1977, Booths sold the Chuck Wagon Restaurant to appellees George and Mary Chamales (Chamales) by a contract for deed and conditional sales contract. The sale included real estate and restaurant equipment. The contract provided for a total sale price of $165,000.00, with $40,000.00 down and $125,000.00 to be paid in forty quarterly payments of $3,125.00, plus eight percent interest on the unpaid balance. On the date of trial, May 11, 1984, all payments had been made on the contract. These payments, with interest, totaled $129,946.50, leaving an unpaid principal of $40,625.00. This contract provided that Chamales must pay all taxes and assessments starting with 1977. The contract required Chamales to execute a U.C.C. filing on December 31 of each year, granting a security interest on the restaurant equipment to secure the unpaid balance due Booths. None was ever filed, except in 1977 and after the trial. The contract further contained an acceleration clause.
On or about July 1, 1977, the real estate agent mistakenly recorded a warranty deed conveying the premises to Chamales from Booths rather than having it held in escrow. During the course of the contract from October 1, 1977 through April, 1984, Booths have accepted late payments on the contract. As of May 10, 1984, the day *844 before the trial, the taxes for 1979, 1981, 1982 and 1983 were unpaid. The total unpaid taxes, plus interest, was $9,245.84. In May, 1982, Booths notified Chamales of the unpaid taxes and their intent to commence an action. On January 29, 1983, Booths again notified Chamales that the most recent installment payment was overdue and taxes remained unpaid. They also indicated their intention of serving a notice of forfeiture and to commence an action if nothing was done by February 7, 1983.
Finally, on December 27, 1983, Booths notified Chamales that if the back taxes were not paid and a U.C.C. form was not filed by January 3, 1984, the contract would be foreclosed. A declaration of forfeiture was served on Chamales on January 17, 1984, and a summons and complaint seeking a strict foreclosure and cancellation of the warranty deed was served on Chamales on February 2, 1984. Booths accepted another $4,000.00 payment on April 3, 1984, which was due on April 1, 1984. Booths had accepted fourteen payments, totaling $75,687.58, since the 1979 taxes had become delinquent on November 1, 1980.
The trial was held on May 11, 1984, and all the facts were stipulated. All payments were current, all delinquent taxes were paid on the day of trial, and the attorney for Chamales assured the court that the U.C.C. filing would be made. It was further stipulated that the deed was recorded by "mutual error." On June 1, 1984, the trial court issued its memorandum opinion which declared a dismissal of the foreclosure action and denial of attorney fees. The trial court later entered a judgment dismissing the foreclosure action, cancelling the erroneously recorded deed, and denying recovery of attorney fees for Booths. Booths appeal, claiming the trial court should have entered a conditional decree of foreclosure and awarded them attorney fees.
In dismissing[1] the foreclosure action, the trial court relied upon our recent decision in Heinzman v. Howard, 348 N.W.2d 147 (S.D.1984), wherein we held that acceptance of late payments constituted a waiver of the contract provision that time of payment was essential. In Heinzman, the foreclosure action was not dismissed but the trial court ruled that the vendor could not rescind the contract.
In the case at bar, the trial court utilized a poor choice of terminology when it referred to its decision as a dismissal. As a matter of fact, the action was not dismissed. Findings of fact and conclusions of law were entered and a judgment cancelling the erroneous deed. Brushing aside the semantics employed, the trial court ruled similarly to the ruling in Heinzman, supra. Under strict foreclosure, the trial court has power to equitably adjust the rights of all parties and to fix the time within which the party or parties in default must comply with the terms of such contract. SDCL 21-50-2, -3. Clearly, the trial court had the power to reach the result it did in this case. Booths accepted late payments after the taxes became delinquent and failure to file the annual U.C.C. statements. By this action, Booths clearly indicated a desire to continue the contract when they accepted payment after the declaration of forfeiture was served and after the action was started and issue joined.[2] Obviously, Booths wanted Chamales' to comply with the provisions of the contract, which they finally did on the day of trial. We are unwilling to reverse the trial court on the foreclosure issue because it used the wrong terminology. On a remand, it could accomplish exactly the same result which, under this record, we believe is correct.
The trial court, however, refused to award any attorney fees in this case. SDCL 21-50-4 provides a reasonable attorney fee may be awarded in such actions in the discretion of the court. In its memorandum opinion and later in its conclusions of law, the trial court held no attorney fees could be granted because the foreclosure *845 action was dismissed. No authority was cited for this conclusion. Perhaps the trial court based its decision on SDCL 15-17-1, which permits "costs" to the prevailing party in civil actions.
In any event, an award of attorney fees in a foreclosure action of an executory contract for the sale of real property is controlled by a special statute, SDCL 21-50-4, as distinguished from the general provisions relating to costs found in SDCL ch. 15-17. In the case at bar, the trial court did not exercise its discretion, as provided for in SDCL 21-50-4, but concluded it could not award attorney fees because no decree of foreclosure was granted. We hold that under the facts of this case the trial court should have exercised its discretion, as provided by SDCL 21-50-4, and made a decision regarding an award of attorney fees. In this case, Chamales stalled until the day of trial before complying with all the terms of the contract.
We remand to the trial court to exercise its discretion in awarding attorney fees as provided by SDCL 21-50-4.
WOLLMAN, MORGAN and HENDERSON, JJ., and TSCHETTER, Circuit Judge, concur.
TSCHETTER, Circuit Judge, for FOSHEIM, C.J., disqualified.
NOTES
[1]  The trial court's terminology.
[2]  The trial court noted in its memorandum decision that it was its understanding that everything had been "disposed of" except attorney fees.
