
835 P.2d 677 (1992)
122 Idaho 442
Michael BADELL, Plaintiff-Respondent,
v.
Linda BADELL, Defendant-Appellant.
No. 19450.
Court of Appeals of Idaho.
July 31, 1992.
*678 Roger E. Crist, Ketchum, for defendant-appellant.
Edward A. Lawson, Ketchum, for plaintiff-respondent.
SILAK, Judge.
Michael and Linda Badell executed a Marriage Settlement Agreement (the Agreement) in November, 1988, in anticipation of the dissolution of their marriage. Earlier in their marriage, Michael had used his separate property to pay $44,000 of the couple's anticipated 1986 tax liability; this resulted in a large overpayment. A portion of the overpayment was applied to the couple's tax liability for 1987 and 1988, leaving a total overpayment of $11,258. In 1989, after their divorce, the couple received a tax refund check for $11,258. Arguing that the refund belongs to him under the terms of the Agreement, Michael moved to compel Linda to comply with the divorce decree and pay the tax refund to him. In response, Linda filed a motion seeking the same tax refund. The magistrate concluded that the tax refund provision in the Agreement was ambiguous and admitted parol evidence to determine the intent of the parties regarding the allocation of the tax refund. After hearing testimony from both parties, the magistrate awarded the entire tax refund to Michael.
Linda appealed the magistrate's order to the district court which affirmed the order. Linda has appealed to this Court arguing that the magistrate erred in concluding that the tax refund provision in the marriage settlement contract was ambiguous. Linda further contends that the accounting *679 firm specified in the contract as the entity to determine which party would receive any tax refunds had the sole authority to make that determination. Linda also argues that the magistrate erred in awarding attorney fees to Michael. We affirm the magistrate's order.

I. FACTS AND PROCEDURAL BACKGROUND
Both Michael and Linda owned separate property when they entered into their marriage. When they decided to divorce, the couple agreed to try to settle their complicated financial relationship by working with Ray Bregante, an accountant who handled the couple's financial matters during part of their marriage.
Linda's separate property includes an ownership interest in a limited partnership. Bregante testified that the income from the partnership took tremendous swings "anywhere from huge losses to positive income." On the other hand, Michael, an orthodontist, had a relatively stable and predictable income from his practice.
In 1986, Linda had a large income from the partnership. Bregante estimated that the couple would have a $44,000 tax liability for that year. In order to pay the 1986 tax, Michael refinanced the office building which he owned separately as part of his practice. The actual taxes were $20,000 less than Bregante estimated. This resulted in an overpayment. Rather than taking the overpayment as a refund, the couple left it as a credit toward their 1987 taxes. After the 1987 taxes were paid, the couple still had a $15,353 credit. The Badells again chose to leave the overpayment as a credit toward their 1988 taxes. After the parties filed their 1988 taxes, $11,258 remained of the $15,353 credit.
During 1988, the Badells decided to dissolve their marriage. Both Michael and Linda retained attorneys to represent them in settlement negotiations. They signed the Agreement on November 21, 1988. The Agreement contains a provision which addresses the division of any tax refunds for tax returns paid during the marriage. It states:
Any refund of taxes paid to the parties as a result of the tax returns filed during a period of the marriage (and provided that such tax returns pertain to income, deductions, credit or other matters arising during the period of the marriage), shall be shared by the parties based upon a formula of computing the tax based upon that party's income as if they were not married. Consideration should be given to whose funds were used to pay any estimated tax payments. The parties designate Bregante and Company of San Francisco, California to make calculations and determine how the parties should share any tax refund. Neither party is authorized to endorse the name of the other on refund checks that may be forthcoming.
Michael filed for divorce on December 8, 1988, anticipating that a stipulated default decree would be entered later that month. Shortly before the end of December, 1988, Bregante asked Michael to postpone the divorce until January, 1989. Bregante explained that Linda could take advantage of Michael's unused tax deductions to reduce her 1988 tax liability if the couple postponed the divorce and filed jointly as married. Michael agreed to this arrangement which resulted in a $19,672 tax savings for Linda. With the exception of social security tax, Michael had no tax liability. The divorce decree was entered on January 16, 1989. Though Bregante prepared the 1988 tax return, Michael hired a new accountant due to a dispute over the bill for the preparation of the return. On October 16, 1989, the last day of the extended period to file the 1988 return, Linda took the return to Michael's office. Michael examined the return, the last page of which indicated that the tax credit of $11,258 was to be credited to Linda's 1989 tax liability. Michael contacted his new accountant and his attorney. Upon their advice, Michael removed the last page of the return and substituted a page which indicated that the tax credit should be refunded. A refund check for $11,258 was issued jointly to Michael and Linda.
*680 On February 1, 1990, Michael filed a motion to compel compliance with this provision of the Agreement and requesting an order that Linda pay Michael $11,258 by endorsing the check. Michael also requested interest, costs, and attorney fees. In response, Linda filed a motion asking that the refund be awarded to her. She also asked for an increase in child support, reimbursement for medical insurance payments, and attorney's fees and costs; these issues were decided by the magistrate and are not before us on appeal.
Following a hearing on these motions, the magistrate awarded the tax refund to Michael. The magistrate held that portions of the tax refund provision in the settlement agreement were ambiguous. In order to determine the intent of the parties, he accepted parol evidence. Bregante testified that, when he did an accounting of the parties' community and separate assets, he took into account Michael's $44,000 tax payment and offset it against other property which Michael was to receive in the marriage settlement. Michael and his accountant both testified that they never saw Bregante's accounting of the reconciliation of the parties' accounts and assets. The magistrate found that the parties never reached an agreement regarding the ownership of the tax credit. Based on the testimony of the parties, the magistrate found that, in allocating the entire tax credit to Linda, Bregante had failed to take into consideration the factors specified in the tax refund provision of the marriage settlement agreement. Relying on the fact that Michael had made the original $44,000 tax payment from his separate funds, and rejecting Bregante's testimony that Michael had previously been credited with this amount, the magistrate awarded the $11,258 refund to Michael. For the reasons stated below, we affirm the magistrate's order.

II. STANDARD OF REVIEW
The district court is considered an intermediate appellate court when it hears an appeal from a judgment in the magistrate division. Therefore, we are required to independently review the magistrate division's record to determine whether there is substantial and competent evidence to support the magistrate's findings of fact, and to determine whether the magistrate correctly applied the law to the facts found. Josephson v. Josephson, 115 Idaho 1142, 1144, 772 P.2d 1236, 1238 (Ct.App.1989); Gardner v. Gardner, 107 Idaho 660, 662, 691 P.2d 1275, 1277 (Ct.App.1984).
[T]he trial court, not this court on appeal, resolves the conflicting evidence and determines the weight, credibility and inferences to be drawn from such evidence; furthermore, where there is substantial and competent, although conflicting evidence of such acts and conduct, the findings of the trial court will not be disturbed.
Gapsch v. Gapsch, 76 Idaho 44, 48-49, 277 P.2d 278, 280 (1954) (citation omitted); see also Evans v. Evans, 92 Idaho 911, 917, 453 P.2d 560, 566 (1969).
As a preliminary matter we note our standard of review. The question whether a contract is ambiguous is a question of law which is subject to free review on appeal. DeLancey v. DeLancey, 110 Idaho 63, 65, 714 P.2d 32, 34 (1986); Roeder Mining, Inc. v. Johnson, 118 Idaho 96, 97, 794 P.2d 1152, 1153 (Ct.App. 1990). Hoffman v. United Silver Mines, Inc., 116 Idaho 240, 245, 775 P.2d 132, 137 (Ct.App. 1989). A contract is ambiguous, as a matter of law, if it is reasonably subject to conflict in its interpretation. Rutter v. McLaughlin, 101 Idaho 292, 293, 612 P.2d 135, 136 (1980); Hoffman, 116 Idaho at 246, 775 P.2d at 138. If a contract is ambiguous, its meaning turns on the underlying intent of the parties. Intent is a question of fact to be determined by the factfinder in light of the language of the entire agreement, the parties' conduct, the course of prior negotiations, and other extrinsic information. Ramco v. H-K Contractors, Inc., 118 Idaho 108, 111, 794 P.2d 1381, 1384 (1990). In considering this issue, we note that the primary aim in interpreting all contracts is to ascertain the mutual intent of the parties at the time the contract was made. USA Fertilizer Inc. v. Idaho First Nat'l. Bank, 120 Idaho 271, *681 273, 815 P.2d 469, 471 (Ct.App.1991) (citing Jeff D. v. Andrus, 899 F.2d 753, 760 (9th Cir.1989)); see also Rutter, 101 Idaho at 293, 612 P.2d at 136. The intent of the contracting parties should, if possible, be ascertained from the language of the agreement, as the words used are the best evidence of the parties' intent. USA Fertilizer, 120 Idaho at 273, 815 P.2d at 471; Abel v. School District No. 413, 108 Idaho 982, 985, 703 P.2d 1357, 1360 (Ct.App.1985); RESTATEMENT (SECOND) OF CONTRACTS § 202 (1981).

III. JUDICIAL REVIEW OF BREGANTE'S DETERMINATION
We turn first to the question whether either party could challenge Bregante's determination of which party would receive the tax refund. On appeal, Linda argues that the marriage settlement contract is unambiguous. Linda contends that the parties designated the accounting firm, Bregante and Company, to determine how any tax refund was to be distributed between the parties. She argues that Bregante and Company was given complete authority to make this determination and was only to be guided by the computation formula. In other words, neither party has a right to challenge Bregante's decision regarding the allocation of the tax refund. Under this argument, Bregante's decision is not subject to judicial review.
The portion of the provision in question states: "The parties designate Bregante and Company of San Francisco, California to make the calculations and determine how the parties should share any tax refund." The magistrate did not conclude that this sentence was ambiguous; the magistrate interpreted the provision as a matter of law. He simply held that Bregante and Company did not have unbridled discretion in computing the tax refund. This holding is legally sound.
The interpretation and legal effect of an unambiguous contract are questions of law to be resolved by the court. Luzar v. Western Surety Co., 107 Idaho 693, 697, 692 P.2d 337, 341 (1984); Hoffman, 116 Idaho at 245, 775 P.2d at 137; see Galaxy Outdoor Advertising v. Idaho Transp. Dept., 109 Idaho 692, 695, 710 P.2d 602, 605 (1985); see also St. Clair v. Krueger, 115 Idaho 702, 704, 769 P.2d 579, 581 (1989). In the present case, we note that Bregante's authority to determine how the parties should share the tax refund was circumscribed by the factors articulated in the tax refund provision. Bregante was authorized to calculate each party's tax liability for the year in question and to determine whose separate funds were used to pay the estimated tax liability. We also note that the agreement does not state that Bregante had the sole and exclusive authority to make this determination: moreover, the agreement does not state that Bregante's determination cannot be challenged by one of the parties if that party is concerned that Bregante did not consider the factors set out in the agreement. Without a specific statement limiting the parties' ability to challenge Bregante's determination, no such limitation can be read into the language of the marriage settlement contract.
This interpretation is consistent with the general contractual duty to act in good faith. See I.C. § 28-1-203 (obligation of good faith is imposed on every contract and duty entered into under the Uniform Commercial Code); Metcalf v. Intermountain Gas Co., 116 Idaho 622, 626, 778 P.2d 744, 748 (1989) (recognizing covenant of good faith and fair dealing in employer-employee relationships); White v. Unigard Mut. Ins. Co., 112 Idaho 94, 97, 730 P.2d 1014, 1017 (1986) (recognizing the covenant of good faith and fair dealing in insurance contracts); Luzar, 107 Idaho at 696, 692 P.2d at 340 (holding that good faith and fair dealing are implied obligations of every contract); compare Idaho First Nat. Bank v. David Steed & Assoc., 121 Idaho 356, 360, 825 P.2d 79, 83 (1992) (covenant of good faith and fair dealing cannot override express provision in contract negotiated and executed by parties). This interpretation is also consistent with the principles of equity which govern marriage dissolution. See generally I.C. § 32-712 (in divorce action, court must divide community property in just manner).
*682 When parties enter into a contract, they assume not only the contractual duties imposed by their agreement, they assume a duty to act in good faith. Luzar, 107 Idaho at 696, 692 P.2d at 340; Cuddy Mountain Concrete v. Citadel Construction, Inc., 121 Idaho 220, 230, 824 P.2d 151, 161 (Ct.App.1992). This premise applies not only to commercial contracts, it also applies to other civil contracts including marriage dissolution agreements. See DeLancey, 110 Idaho at 65, 714 P.2d at 34 (the same rules of construction applicable to contracts and written documents in general apply to the interpretation of divorce decrees). In this case, the marriage settlement agreement was incorporated into the divorce decree. In order to assure that the division of property is equitable, there must be judicial review of the accountant's decision to assure that the accountant acted within the scope of the authority granted to him and that he made the decision based on the factors which he was required to consider. In essence, the accountant may not make his decision in an arbitrary manner because such a decision would not evidence good faith and because it would not comport with equitable principles.

IV. AMBIGUITY OF THE TAX REFUND PROVISION
We turn then to the question whether the magistrate erred when he held that the standards for dividing the tax refund were ambiguous and therefore considered parol evidence to interpret the intent of the parties regarding those factors. The computation formula takes into account two factors: (1) a determination of each party's income as though the couple was not married; and (2) the consideration of whose funds were used to pay any estimated tax payments.
The magistrate reasoned that the first factor was ambiguous because the parties' tax liability varied depending on whether they filed as married filing jointly or whether they each filed separately. The magistrate noted that the parties did not divorce in 1988 as they had originally planned. Because of this, the magistrate concluded that the first factor was ambiguous because it did not contemplate the situation which actually occurred. We disagree. Regardless of the marital status of the parties, it is possible to calculate their tax liabilities hypothetically as though they were filing separately. The problem, as we will discuss below, is that Bregante never made this calculation.
The magistrate also held that the second factor, the determination of whose funds were used to pay the estimated tax liability, was ambiguous because it is not clear what weight should be given to that factor. As we noted above, a contract is ambiguous if it is reasonably subject to conflicting interpretation. DeLancey, 110 Idaho at 65, 714 P.2d at 34; Rutter, 101 Idaho at 293, 612 P.2d at 136; George v. University of Idaho, 121 Idaho 30, 35, 822 P.2d 549, 554 (Ct.App.1991). The magistrate held that "[t]he second factor is arguably ambiguous in that [it] can be taken to mean that this factor is one of several considerations, or is of primary importance, or can be considered and then rejected." We agree with the magistrate's reasoning on this point; moreover, we note that the same reasoning applies to the first factor. Because it was not entirely clear from the language of the agreement whether other factors could be, or had been, taken into consideration in dividing the tax refund, the magistrate correctly admitted extrinsic evidence to determine the intent of the parties.
At the hearing both parties presented evidence. Though Linda did not testify, Bregante took the stand to explain how he had arrived at the determination that the tax refund should be allocated to Linda. Bregante said that during the settlement negotiations the parties had asked him to do a reconciliation of their finances. Bregante testified that he had given Michael credit for his $44,100 tax payment in the reconciliation. Because of this offset, Bregante concluded that Linda had actually paid the $44,100; therefore, Linda was entitled to the $11,258 refund. Because he concluded that Linda had paid the original tax liability, Bregante did not ever calculate *683 each party's separate tax liability for 1988 as specified in the agreement.
Michael, his accountant, and the attorney who represented him in the settlement negotiations, all testified that they had never seen any documentation regarding Bregante's financial reconciliation. According to their testimony, Bregante never provided them with his working papers or with a final report. Michael testified that he never had any knowledge about a credit that Bregante had given to him on the internal work papers. In fact, Bregante abandoned the reconciliation project when he was informed that, under Idaho community property law, all income from Linda's separate property was considered to be community property.[1]
Michael testified that he had refinanced his office building in order to pay the 1986 estimated tax payment of $44,100. Bregante acknowledged that he had received copies of the checks Michael used to pay the estimated tax. Both Michael and his accountant also testified that he would have had no tax liability in 1988 other than his social security tax of approximately $1,500. In addition, both Michael and his accountant testified that Linda would have had a large tax liability in 1988 had Michael not agreed to postpone the divorce and had Linda not been able to take advantage of his unused tax deductions. The estimated tax savings to Linda was approximately $20,000.
After concluding that Bregante did not have unbridled discretion to allocate the tax refund, and after hearing evidence that Bregante did not use the formula set out in the settlement agreement for dividing the tax refund, the magistrate found that the parties intended to give primary consideration in dividing the tax refund to the factors set out in the tax refund provision. The magistrate held that the agreement could not be expanded beyond the factors stated and that the one clear objective that could be used to determine who was entitled to receive the tax refund was whose funds were used to pay the tax. Because Michael had paid the estimated tax, Michael was entitled to receive the refund.
As we noted earlier in this opinion, the intent of the parties in entering a contract is a question of fact. In Alumet v. Bear Lake Grazing Co., 119 Idaho 946, 812 P.2d 253 (1991), our Supreme Court said:
It is well established that this Court's review of a lower court's decision is limited to ascertaining whether the evidence supports the findings of fact, and whether the findings of fact support the conclusions of law.... The Idaho Rules of Civil Procedure provide: "In all actions tried upon the facts without a jury ... [f]indings of fact shall not be set aside unless clearly erroneous." I.R.C.P. 52(a). The task of weighing evidence and finding facts is within the province of the trial court and we will not set aside findings made by the trial court unless they are clearly erroneous. Further, we will give due regard to the opportunity of the trial judge to weigh conflicting testimony and to judge the credibility of witnesses.... We must accept the trial court's findings of fact if they are supported by substantial, competent though conflicting evidence, however meager.... [We have previously] stated: "This standard of appellate review is salutary in effect, and reflects the view that deference must be afforded to the trial court's special opportunity to assess and weigh the credibility of the witnesses who appear before it personally".... It follows that the conclusions of the trial court which are supported by the findings of fact will not be disturbed on appeal....
Alumet, 119 Idaho at 949, 812 P.2d at 256 (citations omitted). We have reviewed the record in this case. Based on the testimony discussed above, we conclude that there is substantial evidence to support the magistrate's findings of fact regarding the parties' intention to give primary importance to the factors set out in the tax refund provision in dividing the refund of the $11,258 *684 overpayment. Consequently, we will not disturb these findings on appeal.

V. ATTORNEY FEES
We turn finally to the question of attorney fees. Linda contends that the magistrate erred in awarding attorney fees to Michael. After the magistrate entered a judgment on the merits of the case, both parties filed motions requesting attorney fees. Each then objected to the other party's claim for attorney fees. Linda objected to Michael's request on the basis that "the fees claimed were unreasonable and excessive, and further that a substantial portion of the claimed fees related to issues on which the Plaintiff [Michael] did not prevail or were unrelated to issues on which the Plaintiff did prevail."
On appeal, Linda has submitted an additional argument regarding the award of attorney fees below. She contends that, under the terms of the Agreement, attorney fees may only be awarded if an action was brought to enforce the terms of the contract. She argues that Michael's motion to request compliance with the terms of the Agreement was not an action to enforce the agreement, but rather a motion to interpret the terms of the contract. We are not persuaded by this argument because the "enforcement" of the contract reasonably follows from the "interpretation" urged by Michael.
We now review the magistrate's order to determine if he erred in awarding attorney fees to Michael. Attorney fees can be awarded by the trial court when provided for by contract. I.R.C.P. 54(e)(1). In claims for attorney fees under a contract, the trial court must first interpret the contract to determine if attorney fees are appropriate before making the discretionary determination as to who is the prevailing party. Thieme v. Worst, 113 Idaho 455, 461, 745 P.2d 1076, 1082 (Ct.App.1987).
As we have discussed at length above, the interpretation of a contract is a question of law over which we exercise free review. A review of the magistrate's order regarding attorney fees indicates that he reviewed the terms of the Agreement to determine whether an award of attorney fees was appropriate on the issues which were presented to him. The magistrate concluded that an award of attorney fees on the issue of the modification of child support would be inappropriate because this issue was specifically excluded under the terms of the Agreement. On the other hand, the award of attorney fees on the tax refund issue was appropriate because this was an express provision of the Agreement. We find no error in the magistrate's interpretation of the contract.
Paragraph XXII of the Marriage Settlement Agreement states in pertinent part:
In the event that either party hereto retains an attorney to enforce any right or duty arising out of this Agreement, the prevailing party in such dispute shall be entitled to be paid reasonable costs and attorney's fees by the non-prevailing party.
In awarding attorney fees to Michael, the magistrate found that, though both parties prevailed on certain issues below, Michael prevailed on the issue regarding the tax refund. The criteria set forth in Rule 54(d)(1)(B) are used to determine the prevailing party in a contract litigation:
In determining which party to an action is a prevailing party and entitled to costs, the trial court shall in its sound discretion consider the final judgment or result of the action in relation to the relief sought by the respective parties, whether there were multiple claims, multiple issues, counterclaims, third party claims, cross-claims, or other multiple or cross issues between the parties, and the extent to which each party prevailed upon each issue of such issue or claims. The trial court in its sound discretion may determine that a party to an action prevailed in part and did not prevail in part, and upon so finding may apportion the costs between and among the parties in a fair and equitable manner after considering all of the issues and claims involved in the action and the resultant judgment or judgments obtained.
*685 The magistrate's decision as to which party, if any, prevailed is discretionary. When an exercise of discretion is reviewed on appeal, the appellate court conducts a multi-tiered inquiry. The sequence of the inquiry is: (1) whether the lower court rightly perceived the issue as one of discretion; (2) whether the court acted within the outer boundaries of such discretion and consistently with any legal standards applicable to specific choices; and (3) whether the court reached its decision by an exercise of reason. Sun Valley Shopping Ctr. v. Idaho Power Co., 119 Idaho 87, 94, 803 P.2d 993, 1000 (1991); see also Associates Northwest, Inc. v. Beets, 112 Idaho 603, 605, 733 P.2d 824, 826 (Ct.App. 1987).
In his order regarding the award of attorney fees, the magistrate held:
The plaintiff husband prevailed on the tax refund issue to the extent of $11,258.00 as stated on pages 8 through 15 of the said Order of June 25.
Comparing the two dollar amounts, $1983.67 [the amount awarded to Linda on the issue of medical costs] versus $11,258.00 or roughly 15% to 85%, then in strictly monetary terms the plaintiff is the prevailing party.
. . . .
Further, and regardless of the dollar amounts, it is clear by considering the totality of the motions, memorandums, and affidavits filed and lodged, and the witnesses who testified and the exhibits presented at the hearing, that the real, significant, and primary issue in this case was the tax refund question. The other issues were considerably of secondary importance to the parties. Because the plaintiff [Michael] prevailed on this issue, he is the "prevailing party" in the context of this litigation as applied to paragraph XXII of the property settlement agreement.
The magistrate then reviewed the memorandum in support of attorney fees and noted that the time itemizations did not clearly separate the amount of time spent on each individual issue. The magistrate determined that it was reasonable to award Michael 75% of the amount claimed for attorney fees based on the fact that Michael had incurred approximately 25% of his attorney fees in defending against Linda's claims. We conclude that the magistrate employed the discretion accorded him in determining the prevailing party and did so in a reasonable way. We affirm the award of attorney fees.
We turn finally to the award of attorney fees on appeal. Pursuant to the Agreement, the prevailing party in an action to enforce the agreement is entitled to an award of attorney fees. Because Michael is the prevailing party in this appeal, we award attorney fees to him.
The orders of the magistrate awarding the tax refund and attorney fees to Michael are affirmed. Costs and attorney fees on appeal to respondent, Michael Badell, in amounts to be determined under I.A.R. 40 and 41.
WALTERS, C.J., and SWANSTROM, J., concur.
NOTES
[1]  Bregante had undertaken the reconciliation project by applying a California principle that considered income from separate property to be separate property also.
