INTRODUCTION
T1 Delta Equipment Industrial Systems, Inc. ("DEI") appeals the district court's summary judgment dismissing DEI's setoff counterclaim and ruling that DEI is in unlawful detainer of property owned by Benedict Bichler ("Bichler"). Specifically, DEI challenges the district court's determination that (1) DEI lacked a valid basis for asserting a claim of setoff and (2) DEI's claim of setoff was an improper counterclaim or defense to Bichlet's claim of unlawful detainer.
I 2 We hold that DEI had a valid basis for asserting an equitable claim of setoff and that the district court erred by finding that DEI could not bring its claim of setoff within the unlawful detainer action. We nonetheless uphold the district court's grant of summary judgment resolving the issue of possession of Bichler's property because DEI's claim of setoff does not directly relate to the issue of possession.
BACKGROUND
T3 In May 2003, DEI Systems, Inc. entered into a lease agreement (the "Lease") with Bichler wherein Bichler leased certain real property to DEI. No other entities or individuals were parties to the Lease except Bichler and DEI. The Lease required that DEI pay Bichler rent on the first day of each month. Any failure to pay rent within the time provided could potentially result in a material default under the terms of the Lease. Paragraph 25 of the Lease, entitled "Estoppel Certificate," required DEI, upon Bichler's request, to certify that it had no offsets against enforcement of the Lease or to confirm such claims in writing.
*1206T4 One year into the lease, in May 2004, DEI, Bichler, and David Bevan entered into a purchase agreement (the "Purchase Agreement") with Environmental Services Group, Inc. ("ESG'). Pursuant to the Purchase Agreement, ESG agreed to purchase eighty percent of DEI shares previously owned by Bichler and Bevan. The Purchase Agreement provided ESG with the right "to set-off against any payments due and owing to [Bichler and Bevan] ... any and all amounts that may become due and payable from time to time to [ESG] by [Bichler and Bevan] pursuant to the terms of this Agreement." In conjunction with the Purchase agreement, Bichler and Bevan entered into separate individual employment agreements (the "Employment Agreements") with DEI whereby Bichler and Bevan were employed by and made directors of DEI.
15 Shortly after executing the Purchase Agreement, DEI and ESG determined that Bichler and Bevan had breached (1) their duties as officers of DEI, (2) the Employment Agreements, and (8) the representations, warranties, and covenants of the Purchase Agreement. Based on these alleged breaches, DEI and ESG sent several letters demanding that Bichler and Bevan defend, indemnify, and hold DEI and ESG harmless for alleged losses caused by Bichler and Be-van. In January 2006, DEI indicated that, pursuant to the setoff provision in the Purchase Agreement, it was going to exercise its right to set off its rent obligation under the Lease against the alleged losses caused by Bichler and Bevan. Accordingly, beginning in February of 2006, DEI stopped paying rent, although it continues to occupy the leased premises.
T6 On February 2, 2006, Bichler and Be-van filed an action seeking a declaratory judgment that they did not owe any defense or indemnity obligations to ESG or DEI and that they did not breach the Purchase Agreement. DEI and ESG answered and asserted counterclaims for breaches of the Purchase Agreement, the Employment Agreements, and fiduciary duties Additionally, DEI asserted the right to set off rent payments due or owing to Bichler against any losses caused by Bichler. That action, with all of its claims and counterclaims, remains pending in Third District Court and has been stayed pending resolution of this appeal.
T7 In March 2006, Bichler commenced this action against DEI alleging unlawful detainer due to DEI's failure to pay rent under the Lease. DEI answered, asserting its alleged right of setoff as one of its affirmative defenses. Bichler subsequently moved for summary judgment, asserting that DEI's alleged right of setoff was not a proper defense to the unlawful detainer action.
T8 In granting Bichler's motion for summary judgment, the district court held that "DEI's claim of setoff arising under the Purchase Agreement is not a proper counterclaim under Utah's unlawful detainer statute." Additionally, the district court found that the offset provision in the Purchase Agreement did not belong to DEI, but rather to ESG, and that the Purchase Agreement did not amend or modify the terms or obligations under the Lease, and therefore DEI lacked a valid basis to claim a right of setoff. DEI appealed. We have jurisdiction pursuant to Utah Code section 78A-3-102(8)(J) (2008).
ISSUES AND STANDARD OF REVIEW
T9 DEI asks us to determine whether the district court erred in granting Bichler's motion for summary judgment when it found that (1) DEI lacked a valid basis to assert a claim of setoff and (2) DEI's claim of setoff was not a proper defense or counterclaim to Bichler's unlawful detainer action.
110 Whether the district court appropriately granted or denied summary judgment is a question of law that we review for correctness, giving no deference to its legal conclusions. Parduhn v. Benneilt, 2002 UT 93, 15, 61 P.3d 982. In reviewing a summary judgment ruling, we "view the facts and all reasonable inferences drawn therefrom in the light most favorable to the non-moving party." Dowling v. Bullen, 2004 UT 50, ¶7, 94 P.3d 915.
ANALYSIS
I. DEI HAS A VALID BASIS FOR ASSERTING A CLAIM OF SETOFF
11 Bichler argues that DEI has no valid basis for asserting a right of setoff in the *1207unlawful detainer action because neither the Lease nor the Purchase Agreement gives DEI a contractual right to offset payments of rent against losses allegedly caused by Bichler. DEI argues that even assuming it does not have a contractual right of setoff, it may still assert a counterclaim of setoff as a matter of law because the doctrine of setoff arises in equity. We first determine whether DEI has a contractual right of setoff. Finding that DEI does not have such a right, we then address whether it nonetheless has a basis to assert an equitable right of setoff.
A. DEI Does Not Have a Contractual Right of Setoff
112 DEI argues that both the Lease Agreement and the Purchase Agreement provide it with a contractual right of setoff. We use the principles of contract interpretation to interpret the terms of the Lease and the Purchase Agreement. "The underlying purpose in construing or interpreting contractual provisions is to determine the intentions of the parties." IHC Health Servs. v. D & K Mgmt., 2008 UT 78, ¶44, 196 P.3d 588 (internal quotation marks omitted). Absent ambiguity, we look only "to the language of the contract to determine its meaning and the intent of the contracting parties." Café Rio, Inc. v. Larkin-Gifford-Overton, LLC, 2009 UT 27, ¶ 25, 207 P.3d 1235.
118 DEI argues that paragraph 25 of the Lease provides it with a contractual right to offset rents. We disagree. The Lease clearly identifies Bichler as Lessor and DEI as Lessee of the property. In relevant part, paragraph 25 of the Lease, entitled "Estoppel Certificate," provides that "Lessee shall, within fifteen (15) days after Lessor's request, execute and deliver to Lessor a written declaration in a form adequate for recording ... certifying that there are no defenses or offsets against the enforcement of this lease by the Lessor, or stating those claimed by Lessee." Contrary to DEI's assertion, paragraph 25 does not provide it with a contractual right of setoff. Rather, it merely provides a process whereby Bichler may require DEI to certify to a third party, through an estoppel certificate, that the Lease is valid and that DEI does not intend to assert any legal defense or offset to enforce the Lease. At most, the language of the Lease recognizes that DEI may have an equitable right to setoff apart from the provisions of the Lease.
114 DEI also argues that it has a contractual right of setoff under the terms of the Purchase Agreement. The Purchase Agreement entitles the "Purchaser" to "set-off against any payments due and owing to the Shareholders ... any and all amounts that may become due and payable from time to time to Purchaser by the Shareholders pursuant to the terms of this Agreement. ..." The Purchase Agreement defines ESG as the "Purchaser" and Bichler and Bevans as the "Shareholders." DEI, Bichler, and Bevans are also identified collectively as the "Sellers." Nowhere does the Purchase Agreement define DEI as a "Purchaser." Thus, based on the plain language of the Purchase Agreement, DEI does not have a contractual right to setoff arising from amounts due to its breach. That right belongs solely to ESG as the "Purchaser." Because we find that DEI has no contractual right to setoff under the lease or the Purchase Agreement, we next must address whether DEI has an equitable right of setoff.
B. DEI Has an Equitable Right of Setoff as a Matter of Law
¶15 DEI argues that even if its claim of setoff is not based in contract, it nonetheless has an equitable right of setoff. We agree. "The doctrine of setoff ... is essentially an equitable one requiring that the demands of mutually indebted parties be set off against each other and that only the balance be recovered in a judicial proceeding by one party against another." 20 Am.Jur.2d Counterclaim, Recoupment, and Setoff § 6 (2008) (internal citations omitted). "The right to set-off exists independently of statute and rests upon the inherent power of a court to do justice to the parties before it. It is an equitable right founded on equitable principles." 80 CJ.S. Set-off and Counterclaim § 5 (2000).
¶16 With the adoption of the Utah Rules of Civil Procedure in 1950, "the distinctions between recoupment, setoff, and counterclaim" were "dissolved in Utah." Mark VII Fin. Consultants Corp. v. Smedley, 792 *1208P.2d 130, 133 (Utah Ct.App.1990). Indeed, "[a] 'setoff is [merely] a counterclaim which a defendant may have against a plaintiff to be used in full or partial satisfaction of whatever is owed." Id. at 182 (citing Studley v. Boylston Nat'l Bank, 229 U.S. 528, 528, 33 S.Ct. 806, 57 L.Ed. 1313 (1913)). Therefore, to determine whether DEI has a basis for asserting an equitable right of setoff, we need only determine whether DEI has a cognizable counterclaim against Bichler that, if successful, would entitle DEI to a monetary recovery.
€17 DEI contends that it has valid counterclaims against Bichler for alleged breaches of the Purchase Agreement, the Employment Agreement, and fiduciary duties owed as a director of DEI. We address each of these claims in turn.
118 DEI asserts that ESG and DEI are in essence the same party in interest under the Purchase Agreement and, therefore, a violation of the Purchase Agreement by Bichler can be recovered by either DEI or ESG. We disagree. Under the plain terms of the Purchase Agreement, DEI and ESG are not the same party in interest. The Purchase Agreement identifies ESG as "Purchaser," and Bichler and DEI collectively as "Sellers." Bichler is also identified as a "Shareholder." In general, the duties and obligations in the Purchase Agreement flow between the purchaser on the one hand and the shareholders and sellers on the other. While the terms of the Purchase Agreement might conceivably contain provisions that create mutual obligations between DEI as a seller and Bichler as a shareholder, DEI has not brought to our attention any such provisions. Therefore, we find that DEI has failed to demonstrate that it has a cognizable counterclaim based on a breach of the Purchase Agreement.
119 Additionally, DEI argues that is has a valid counterclaim against Bichler for allegedly violating the Employment Agreement and breaching fiduciary duties as a director of DEI. The Employment Agreement involves two parties: Bichler and DEI. Pursuant to the Employment Agreement, Bichler owed DEI specific obligations and duties. A violation of these duties would entitle DEI to sue Bichler and conceivably recover monetary damages. Therefore, DEI has a cognizable counterclaim against Bichler for an alleged breach of the Employment Agreement. Similarly, as a director of DEI, Bichler owed certain duties to DEI, and DEI has a right to sue Bichler individually for breach of any of those duties. Accordingly, DEI also has a cognizable counterclaim against Bichler for the alleged breach of fiduciary duties. We therefore conclude that DEI has a valid basis for asserting an equitable right of setoff with regard to its claims that Bichler violated the Employment Agreement and breached fiduciary duties as a director of DEL.
120 Having determined that DEI has a valid basis for asserting an equitable right of setoff, we now determine whether these claims are properly raised as counterclaims within an action for unlawful detainer.
II. RULE 18 GOVERNS COUNTERCLAIMS IN AN UNLAWFUL DETAINER ACTION
121 DEI argues that the district court erred when it found that DEI's claim of setoff was an improper counterclaim or defense 1 to Bichler's unlawful detainer action. Bichler, on the other hand, argues that our case law narrowly construes admissible counterclaims in unlawful detainer actions in order to "provide a speedy resolution of the issue of possession." P.H. Investment v. Oliver, 818 P.2d 1018, 1020 (Utah 1991). Our prior cases addressing proper counterclaims in unlawful detainer actions have been less than clear. We therefore take this opportunity to elucidate and provide direction on this issue.
1 22 Prior to our 1950 adoption of the Utah Rules of Civil Procedure, this court espoused the general common law rule that "neither a counterelaim nor cross-complaint of any kind is permissible in an action in unlawful detain-*1209er." Dunbar v. Honsen, 68 Utah 898, 250 P. 982, 984 (1926) (internal quotation marks omitted); see also Forrester v. Cook, 77 Utah 137, 292 P. 206, 212 (1930). This rule was premised on the policy of providing "a more expeditious proceeding" to settle disputes regarding the lawful possession of realty. Dunbar, 250 P. at 984 (internal quotation marks omitted).
'I 23 In 1950, we adopted the Utah Rules of Civil Procedure in order to "simplify and expedite procedure and to consolidate litigation wherever that could be done without confusion or prejudice to the rights of litigants." White v. Dist. Court, 120 Utah 178, 232 P.2d 785, 785 (1951). Shortly thereafter, we held that whether a counterclaim "may be asserted in an [unlawful detainer] action is purely a procedural matter" that is governed by "the provisions of Rule 18 of the New Rules governing counterclaims." Id. Our decision in White rejected any prior limitations on bringing counterclaims in actions for unlawful detainer in favor of following the newly adopted provisions of the rules of civil procedure.
124 When the White decision was issued, rule 18 of the Utah Rules of Civil Procedure included only subsections (a) and (b). While other subsections have been added to rule 18, the language in subsections (a) and (b) remains the same. Subsection (a) governs compulsory counterclaims and mandates that a counterclaim that "arises out of the transaction or occurrence that is the subject-matter of the opposing party's claim" be brought within the same action or it will be barred. Utah R. Civ. P. 18(a); see also, Nu-Med USA, Inc. v. 4Life Research, L.C., 2008 UT 50, ¶ 9, 190 P.3d 1264. On the other hand, subsection (b) of rule 18 governs permissive counterclaims and provides that "[a] pleading may state as a counterclaim any claim against an opposing party not arising out of the transaction or occurrence that is the subject-matter of the opposing party's claim." Utah R. Civ. P. 18(b) {(emphasis added); see also, Faux v. Mickelson, 725 P.2d 1372, 1374 (Utah 1986) (discussing the limits of permissive counterclaims in small claims court actions); Mark VIL Fin. Consultants Corp. v. Smedley, 792 P.2d 130, 132-33 (Utah Ct.App.1990). The use of the word "may" in rule 13(b)
is not intended to confer any discretion upon the court with respect to a permissive counterclaim; rather, it gives the litigant a choice either to assert or not to assert a permissive counterclaim. If he elects to plead it, the court must entertain it so long as it is within the court's subject matter jurisdiction.
Montecatini Edison, S.P.A. v. Ziegler, 486 F.2d 1279, 1282 (D.C.Cir.1978); accord Switzer Bros. v. Locklin, 207 F.2d 483, 488 (7th Cir.1953) ("Both the words 'compulsory' in paragraph (a) and 'permissive' in paragraph (b) are descriptive of the rights of the pleader. Neither has any bearing upon the right or duty of the court when a counterclaim is presented."); Umited States ex rel. Kashulines v. Thermo Contracting Corp., 437 F.Supp. 195, 199 (D.N.J.1976) ("Rule 18(b) by its terms grants [a party] an unqualified right to interpose these unrelated claims, and the court possesses no discretion to reject them."); Power Tools & Supply, Inc. v. Cooper Power Tools, Inc., No. 05-cr-73615-DT, 2007 WL 1218701, *3, 2007 U.S. Dist. LEXIS 29571, at *9 (April 20, 2007) ("[Olnce properly pleaded, a court has no discretion to refuse to consider a permissive counterclaim.").2
1 25 Since our decision in White, we have considered the issue of proper counterclaims in unlawful detainer actions in Lincoln Fin. Corp. v. Ferrier, 567 P.2d 1102 (Utah 1977) and P.H. Investment v. Oliver, 818 P.2d 1018, 1020 (Utah 1991). Bichler argues that our decisions in these more recent cases narrow the scope of proper counterclaims in unlawful detainer actions to those claims that arise out of the same "transaction or occurrence" as the subject matter of the complaint as required by subsection (a) of rule 13. To the degree that Lincoln or P.H. Investment suggest that counterclaims in unlawful de-tainer actions are limited beyond the seope of what is allowed under rule 13, we disavow that suggestion. Indeed, "nothing in the *1210Utah unlawful detainer statute prohibits the assertion of any defense or counterclaim by the defaulting tenant-defendant." PH. Investment, 818 P.2d at 1020. Rather, as we stated in White, whether a counterclaim "may be asserted in an [unlawful detainer] action is purely a procedural matter" that is governed by Utah Rule of Civil Procedure 13. White, 232 P.2d at 785. Rule 18 allows for compulsory and permissive counterclaims, and both may be properly pleaded in an unlawful detainer action.
126 Here, Bichler commenced an unlawful detainer action against DEI, claiming that DEI failed to pay rent due under the Lease. DEI counterclaimed alleging a right to set off the rent payments against losses caused by Bichler. In granting Bichler's motion for summary judgment, the district court ruled that DEI's claim of setoff was an improper counterclaim under Utah's unlawful detainer statute because the claim did not arise out of the same transaction or occurrence as the Lease.
127 The district court's reasoning unduly restricts the seope of permissible counterclaims in unlawful detainer actions by limiting such claims to those that fall within the seope of compulsory counterclaims under Utah Rule of Civil Procedure 18(a). As discussed above, rule 13 applies in its entirety to counterclaims brought in unlawful detain-er actions. While DEIT's claim of setoff may fail to satisfy the requirements of a compulsory counterclaim, it certainly falls within the seope of a permissive counterclaims under rule 13(b). We therefore hold that the district court erred in dismissing DEI's claim of setoff based on its determination that the counterclaim was improper in an unlawful detainer action.
128 Having determined that the district court erred in dismissing DEI's permissive counterclaims, we now address the impact of that error in this case.
III. THE DISTRICT COURT DID NOT ERR IN GRANTING SUMMARY JUDGMENT ON THE ISSUE OF POSSESSION
129 Notwithstanding our determination above, we find that the district court did not err in granting Bichler's motion for summary judgment on the issue of possession because DEI's permissive counterclaim does not directly relate to the issue of possession. Bichler argues that permissive counterclaims should not be allowed in actions for unlawful detainer because they delay the speedy resolution of the issue of possession. We are unpersuaded by Bichler's argument. While we recognize that one of the primary purposes of the unlawful detainer statute is to provide a speedy resolution on the issue of possession, this policy is best served by following our rules of civil procedure instead of carving out narrow exceptions. Specifically, rule 54(b) of the Utah Rules of Civil Procedure provides a means whereby the issue of possession can be speedily resolved while still allowing both parties to bring all legitimate claims such that "all of whatever controversy exists between the parties may be settled as simply and expeditiously as possible." Lincoln Fin. Corp. v. Ferrier, 567 P.2d 1102, 1104 (Utah 1977).
130 In relevant part, rule 54(b) provides:
When more than one claim for relief is presented in an action, whether as a claim, counterclaim, cross-claim, or third-party claim, ... the court may direct the entry of a final judgment as to one or more but fewer than all of the claims ... upon an express determination by the court that there is no just reason for delay and upon an express direction for the entry of judgment."
Utah R. Civ. P. 54(b). Normally, the entry of final judgment on a separate claim is proper under rule 54(b) when "the facts underlying [the separate claim are] ... different than those underlying other claims in the action." Kennecott Corp. v. State Tax Comm'n, 814 P.2d 1099, 1103 (Utah 1991). Recognizing the important public policy of providing a speedy resolution of the issue of possession, we hold that in an unlawful de-tainer action with multiple claims or counterclaims, a rule 54(b) entry of final judgment resolving the issue of possession is proper when it includes all claims and counterclaims that are necessary to determine lawful possession of the property.
*121131 In this case, the trial court's grant of summary judgment effectively resolved all claims and counterclaims by ruling that DEI is in unlawful detainer of Bichler's property and by dismissing DEI's setoff counterclaim on the basis that it was improper in an unlawful detainer action. Therefore, Bichler did not need to request a rule 54(b) entry of final judgment in order to seek appellate review. Nonetheless, given our clarification as to the scope of proper counterclaims in unlawful detainer actions it is appropriate to treat this case as if Bichler had brought such a motion. However, had the district court allowed the counterclaims, Bichler could nevertheless have obtained a speedy resolution of the possession issue by seeking entry of final judgment on that issue under rule 54(b) because DEI's permissive counterclaims did not directly relate to the issue of possession.
132 Before directing an entry of final judgment under rule 54(b) on the issue of possession, the court must resolve all claims relating to possession. Our prior case law indicates that a counterclaim raising a breach of a warranty of habitability must be addressed in determining lawful possession. See P.H. Investment v. Oliver, 818 P.2d 1018, 1021 (Utah 1991) (discussing a claim of breach of warranty of habitability within an unlawful detainer action). Similarly, a claim of wrongful or retaliatory eviction would of necessity go to the issue of lawful possession. See Building Monitoring Sys., Inc. v. Paxton, 905 P.2d 1215, 1218 (Utah 1995) (finding that retaliatory eviction is an affirmative defense to an unlawful detainer action). Here, we are in essence asked to determine whether a right of setoff must be decided prior to determining lawful possession of realty.
¶33 Within a lease agreement, parties could conceivably create a contractual right to set off payments of rent against losses caused by the lessor or incorporate a lease agreement into a subsequent agreement between the same parties that included a similar right of setoff. In such a case, a court would have to entertain the claim of setoff before determining the right to possession because it would directly relate to the lessee's obligation to pay rent. However, that is not this case here where DEI does not have any contractual right to set off rent payments against losses caused by Bichler. As previously discussed, neither the Lease nor the Purchase Agreement provide DEI with a contractual right to set off payments of rent against unrelated losses caused by Bichler. Instead, DEI has equitable claims of setoff arising from Bichler's alleged breach of the Employment Agreement and his alleged breach of fiduciary duties as a director of DEI. Because DEI's equitable claim of setoff does not relate to the issue of possession, the district court need not decide this claim before ruling on the issue of possession. Similarly, had the district court not dismissed DEI's permissive counterclaims, the district court could have directed the entry of final judgment on the issue of possession under rule 54(b).
CONCLUSION
€34 DEI has a valid basis for asserting equitable claims of setoff against Bichler for the alleged breach of the Employment Agreement and the alleged breach of his fiduciary duties as a director of DEI. Rule 18 of the Utah Rules of Civil Procedure applies to unlawful detainer actions and does not bar DEI from asserting its equitable claims of setoff in the unlawful detainer action. The district court erred in its determination that DEI's setoff claim was improper in dismissing those claims. We therefore reverse that dismissal and order that DEI's equitable claim of setoff, as set forth in Part I of this opinion, be reinstated within the unlawful detainer action.3
T 35 The district court did not err, however, in granting Bichler's motion for summary judgment on the issue of possession where DEI's claim of setoff does not directly relate to that issue. We accordingly affirm the district court's order granting summary judgment on the issue of possession, including the district court's determination regarding outstanding rent, interest, late charges, *1212and attorneys' fees incurred in litigating the issue of possession.
T 36 Associate Chief Justice DURRANT and Justice WILKINS concur with Justice PARRISH's opinion.. Although DEI initially pled the right to setoff as a defense and not as a counterclaim seeking affirmative relief, that distinction is not material. See Mark VII Fin. Consultants Corp. v. Smedley, 792 P.2d 130, 133 n. 2, (Utah Ct.App.1990) (citing J.W. Moore, Moore's Federal Practice, § 8:27[3] (2d ed.1989)).
. Because the Utah Rules of Civil Procedure are patterned after the Federal Rules of Civil Procedure, where there is little Utah law interpreting a specific rule, we may look to the Federal Rules of Civil Procedure for guidance. See 438 Main Street v. Easy Heat, Inc., 2004 UT 72, ¶64, 99 P.3d 801.
. We note that DEI has also asserted its claims against Bichler for breach of the Employment Agreement and fiduciary duty claims in a separate action. Given the nature of permissive counterclaims under rule 13 of Utah Rules of Civil Procedure, we leave it to DEI's discretion as to where to pursue these claims.