
139 B.R. 229 (1992)
In re Ronald R. and Sherry C. PATTERSON, Debtor.
KENPAK CONVERTERS, INC., Appellants,
v.
Ronald R. and Sherry C. PATTERSON, Rolling Hills Trust Deed, the City of Santa Ana, and the Chapter 7 Trustee, Appellees.
BAP No. CC-91-1638-OVJ, Bankruptcy No. SA 90-03280-JR.
United States Bankruptcy Appellate Panels of the Ninth Circuit.
Argued and Submitted January 23, 1992.
Decided April 13, 1992.
*230 Bonnie L. McCarthy, Santa Ana, Cal., for Kenpak Converters.
No appearance by any of appellees.
Before OLLASON, VOLINN, and JONES, Bankruptcy Judges.

OPINION
OLLASON, Bankruptcy Judge:
The bankruptcy court avoided a judicial lien and the lien creditor appealed. We reverse.

FACTS
Debtors' home was sold free and clear of liens pursuant to 11 U.S.C. § 363(f) and an order of the bankruptcy court. The order provided that liens attached to the proceeds of sale. After undisputed senior encumbrances were paid, a balance of $122,000 remained. The liens claimed against that sum were, in order of priority as determined by the date of recordation: (1) The judicial lien of Appellant Kenpak Converters, Inc., in the amount of $144,601, (2) the judicial lien of Survival Technology in the amount of $16,419, (3) the consensual lien of Rolling Hills One in the amount of $100,000 plus accrued interest and other charges, (4) the judicial lien of the City of Santa Ana in the amount of $45,000, and (5) the consensual lien of Rolling Hills Investments in the amount of $30,000. The two consensual liens of Rolling Hills One and Rolling Hills Investments were reduced by agreement to a combined total of $75,000.
In addition, debtors claimed a homestead exemption of $45,000. They filed a motion under 11 U.S.C. § 522(f) to avoid the judicial liens, alleging that those liens impaired their homestead exemption. The bankruptcy court's order (1) accepted the stipulation that combined and reduced the two consensual Rolling Hills liens to a total of $75,000, (2) allowed debtors a homestead exemption of $45,000, (3) avoided the judicial liens of Survival Technology and the City of Santa Ana in their entirety, for impairing that exemption, and (4) avoided all but $2,000 of the judicial lien of Appellant Kenpak Converters, also for impairing debtors' homestead exemption.
Kenpak Converters' motion for reconsideration was denied in a memorandum of decision which also constitutes the bankruptcy court's findings of fact and conclusions of law. The court's memorandum reveals that its decision was based on In re Galvan, 110 B.R. 446 (9th Cir. BAP 1990):

Galvan is the controlling case in the Ninth Circuit for avoidance of judicial liens under § 522(f)(10). It uses a two-step method to determine whether a judicial lien impairs the debtor's homestead exemption. The first step is to determine equity in the absence of judicial liens [footnote omitted]; the second is to determine the extent the judicial liens impair the homestead exemption [footnote omitted]. Galvan then avoids the remaining portion of the judicial liens deemed unsecured under § 506(a).
Applying the first step, the bankruptcy court determined equity in the absence of judicial liens by deducting the amount of the non-judicial liens from the remaining sale proceeds of $122,000. The only non-judicial lien was the reduced and combined Rolling Hills lien of $75,000. The deduction for that lien left a proceeds balance of $47,000. Applying the second step, the court determined that the debtors' homestead exemption was impaired by all but $2,000 worth of judicial liens. Since Kenpak Converters was first in right among the judicial liens, it was awarded the entire $2,000, and the rest of its lien, and all of the other judicial liens, were entirely avoided. Id. The bankruptcy court's order was stayed pending this appeal.

QUESTIONS PRESENTED AND STANDARD OF REVIEW
Appellant contends that the bankruptcy court applied the rule in Galvan *231 beyond its facts, and thereby improperly reordered the priorities of liens claimed against the subject sale proceeds. There being no disputed facts, the determination of priorities among liens is a question of law subject to de novo review.

DISCUSSION
The order of priority among the interests claimed against the property in Galvan was (1) the consensual lien, (2) the homestead exemption, and then (3) the judicial lien. Under those and similar circumstances, the construction placed upon Galvan by the bankruptcy court yields a result that is legally correct. In the subject case, however, there is no such lineal order of priority since appellant's lien is senior to the consensual lien of Rolling Hills. The consensual lien of Rolling Hills is senior to the homestead exemption but junior to the judicial lien of Appellant Kenpak Converters. The debtors' homestead exemption is senior to the judicial lien of Kenpak Converters, but junior to the consensual lien of Rolling Hills. The other judicial liens were clearly unsecured in their entirety and were properly avoided.
Galvan recognized that the analysis applicable to its facts may not be appropriate in other circumstances:
We recognize that in this case the mechanical application of section 522(f) is rather straightforward as the judicial lien is the junior encumbrance on the property. Other cases can be more involved and will require more intense consideration. See In re Duncan, 43 B.R. 833 (D.Alaska 1984). Those faced with more complex situations may benefit from the thoughtful approaches found in In re Braddon, [57 B.R. 677, 679 (W.D.N.Y.1986) and] In re Kruger, [77 B.R. 785, 788-89 (Bankr.C.D.Cal.1987).]
In re Galvan, 110 B.R. at 452 n. 1. The pertinent provisions of the bankruptcy code do not by their terms suggest or require any reordering of the priorities among lien claimants. State law provisions concerning the priority of liens should be preserved where not inconsistent with the bankruptcy code.
The formula set forth in In re Kruger, 77 B.R. 785, 788-89 (Bankr. C.D.Cal.1987), provides the correct result in this case and in various other circumstances:
1. Subtract all liens from the value of the property.
2. If the total amount of the liens is equal to or less than the value of the property and there is a judicial lien, deduct from the amount of the judicial lien the claimed exemption less the amount of equity (if any) remaining in the property after step 1. The balance left is the amount of the judicial lien which remains on the property.
3. If the total of the liens is greater than the value of the property and if the liens which are equal to the value of the property are all voluntary liens, void all liens in excess of the value of the property.
4. If the total of the liens is greater than the value of the property and the judicial lien was not voided in full in step 3, determine whether the judicial lien would be partially avoided under § 506(d):
a. If the judicial lien is not fully secured under § 506(a), void the unsecured portion and subtract the amount of the exemption from the secured portion. This is the remaining amount of the judicial lien. Then recalculate the total liens against the property (using the reduced judicial lien) and void any lien in excess of the value of the property.
b. If the judicial lien is fully secured under § 506(a), subtract the amount of the exemption from the amount of the judicial lien. The balance is the remaining amount of the judicial lien. Then recalculate the total liens against the property (using the reduced judicial lien) and void any liens in excess of the value of the property [footnotes omitted].
Under paragraph 4(a) of the Kruger analysis, Kenpak Converters' lien is reduced to $122,000, and the $45,000 exemption is subtracted. Kenpak's reduced judicial lien is $77,000. Using that reduced *232 judicial lien, only the first $45,000 of the Rolling Hills lien, next in priority, is secured. The remainder of that lien and all junior liens are unsecured and are avoided.
By separately comparing each of the three interests in the subject property with each of the other two, Kruger's preservation of the priorities established by state law and the Bankruptcy Code are readily apparent. Kenpak Converters' lien claim against the $122,000 in sale proceeds is senior to that of Rolling Hills, but junior to the debtors' $45,000 homestead exemption. Therefore, Kenpak takes $77,000. The lien of Rolling Hills is junior to Kenpak's and cannot disturb Kenpak's recovery. It is senior to the debtors' homestead exemption, however. Therefore, Rolling Hills takes $45,000. Debtors' $45,000 homestead exemption is senior to any claim of lien by Kenpak in excess of the $77,000, but is junior to the consensual lien of Rolling Hills. Therefore, debtors take nothing.

CONCLUSION
The language of the formula announced by the panel in Galvan can lead to erroneous results where the judicial lien, which can be defeated in whole or part by a homestead exemption, is senior in priority to the consensual lien, which cannot be defeated by a homestead exemption. Unlike the facts in Galvan, the case presently before us involves a judicial lien which is senior in priority to a consensual lien. A rigid application of the Galvan formula in this case would reorder the lien priorities established by state law. That result is not compelled by the bankruptcy code. The formula set forth in Kruger, however, appears to lead to the result contemplated by the code under the facts of this case and in other circumstances.
The judgment of the bankruptcy court is reversed and the matter remanded for entry of judgment consistent herewith.
