The opinion of the court was delivered by
Schroeder, J.:This is an action for a declaratory judgment to construe the terms of a written contract for the sale of several oil *491and gas leases. The defendant has duly perfected an appeal from a judgment decreeing that the plaintiffs are the owners of a l/7th of 7/8ths overriding royalty interest in the oil and gas leases and ordering the defendant to account to the plaintiffs therefor.
The question is whether the plaintiffs’ overriding royalty interest reserved in the contract of sale continued during the entire life of the leases or whether such interest terminated when H. K. Dougherty, the original assignee, ceased operating these particular oil and gas leases.
The facts pertinent to the issue in this case are not in dispute. They have been established either by stipulation or admission of the parties.
On January 26, 1939, the plaintiffs, Weiner and Kienzle, were the owners of a 7/8ths working interest in five oil and gas leases located in Neosho County, Kansas. On that date they entered into a written contract with H. K. Dougherty granting him the option for ninety days to purchase said leases and appurtenant equipment, and the right to investigate the property and to drill test wells. The contract further fixed the purchase price and method of payment in the event the option was exercised.
The principal issue in this case involves the construction of the-last sentence in paragraph 3 (c) of the written contract. This, paragraph, in its entirety, provides as follows:
“Weiner and Kienzle shall except and reserve from said assignments covering the leased lands an undivided one-seventh (l/7th) interest in all oil and gas produced and saved from the 7/8ths working interest in said leases, hereinafter referred to as the overriding royalty interest; and Dougherty shall deliver or cause to be delivered to the pipe lines to which said leases are connected an undivided l/7th of the 7/8ths working interest in such oil or gas as may be produced and saved and sold from said leases free and clear to Weiner and Kienzle of all cost and expense (except taxes assessable against the overriding interest and the production therefrom); provided that Dougherty shall have the right to use crude oil and gas produced from the herein demised premises for his operations on said premises, such oil and gas so used to be free of overriding royalties under the terms of this agreement. This overriding royalty interest shall continue so long as Dougherty operates the properties hereunder.” (Emphasis added.)
The written contract further provides that Dougherty, in the event of his intention to abandon any of the leases after two years because of nonprofitable operation, shall give notice of such intention to Weiner and Kienzle, who shall have the preferential right of repurchase.
*492The last paragraph o£ the written contract provides:
“9. It is further agreed that all the terms, covenants, stipulations and agreements herein contained shall extend to and bind the heirs, executors, administrators, successors and assigns of the respective parties.”
On April 20, 1939, a modification of the written contract was entered into between the parties, in which the method of payment, but not the amount, was changed, and in which paragraph 3(b) was deleted from the contract. Neither modification is material to this controversy.
On April 24, 1939, and within the ninety-day option period, Dougherty exercised the option.
At all times from and after January 26, 1939, Weiner and Kienzle were apprised by Dougherty that he (Dougherty) was acting as the agent for Hugh Grant, Bradford, Pennsylvania, doing business under the name and style of Kirby Oil Company, and that Dougherty was not performing solely for himself or for an undisclosed principal.
On June 15, 1939, Weiner and Kienzle, pursuant to the terms of the contract, assigned said leases to Dougherty, in the form of an assignment attached to the contract, in which Weiner and Kienzle reserved the following interest:
“. . . save and except that the undersigned hereby reserve and except to themselves, their heirs and assigns, an undivided one-seventh (1/7) of the oil and gas produced, saved and sold from the 7/8ths working interest of the leases hereby assigned, free and clear of all cost and expense, save taxes, all subject to the terms and conditions of the agreement dated January-, 1939, between the parties hereto concerning the aforesaid leases.”
On June 16, 1939, effective June 17, 1939, Weiner, Kienzle and Dougherty executed and delivered to the oil purchaser their transfer orders setting over to Dougherty the proceeds from the oil produced and sold under 6/7ths of the 7/8ths working interest.
On July 8, 1939, Dougherty assigned said leases to the Kirby Oil Company. The assignment contained the following special provisions:
“But subject to the reservation and exception of an undivided 1/7 of the oil and gas produced, saved and sold from the 7/8 working interest of the aforesaid leases, free and clear of all cost and expense save taxes, reserved by Carl Weiner and John G. Kienzle in the Assignment of the aforesaid oil and gas leases by them to H. K. Dougherty dated June 15, 1939, recorded in Book 24M, page 448, reference to which is hereby made for the terms thereof; and also subject to the terms and conditions of the Contract dated January 26, 1939, between Carl Weiner and John G. Kienzle as first parties and H. K. Dougherty as second party as modified by supplemental contract dated April 20, 1939, between the same parties concerning the aforesaid *493leases; and also subject to the mortgage dated June 15, 1939, from H. K. Dougherty as mortgagor to Carl Weiner and John G. Kienzle as mortgagees covering the above described property and given to secure the sum of $22,500.00.
"That for the same consideration, and as a part hereof, the Assignor, H. K. Dougherty, hereby assigns to Kirby Oil Company the said Contract of January 26, 1939, and the said Supplemental Contract of April 20, 1939, and all rights thereunder, between Carl Weiner and John G. Kienzle and H. K. Dougherty with respect to the aforesaid leases; and the Assignee, Kirby Oil Company, hereby assumes all of the obligations thereof, and agrees to perform the same according to the terms and conditions and the tenor thereof; and the Kirby Oil Company assumes the payment of said mortgage for $22,500.00 and the indebtedness secured thereby; and the Kirby Oil Company shall save the assignor free and harmless of any and all loss or liability that may arise under, out of, or in connection with said contract as modified and said mortgage.”
This assignment was duly recorded on July 17, 1939.
On July 11, 1939, effective July 1, 1939, Dougherty and Kirby Oil Company executed and delivered to the oil purchaser their transfer orders setting over to Kirby Oil Company the proceeds from the oil produced and sold under 6/7 of the 7/8 working interest.
On July 1, 1944, Kirby Oil Company assigned said leases to Grant & Mohan Oil Company, which assignment contained the exact special provisions above quoted. This assignment was duly recorded on September 21,1944.
In June and August, 1944, effective July 1, 1944, Kirby Oil Company and Grant & Mohan Oil Company executed and delivered to the oil purchaser their transfer orders setting over to Grant & Mohan Oil Company the proceeds from the oil produced and sold under 6/7ths of the 7/8ths working interest.
On January 15, 1945, Grant & Mohan Oil Company assigned said leases to Frank Young. The assignment contained the following special provisions:
. . But subject to the reservation and exception of an undivided 1/7 of the oil and gas produced, saved and sold from the 7/8 working interest of the aforesaid leases, free and clear of all cost and expense save taxes, reserved by Carl Weiner and John G. Kienzle in the Assignment of the aforesaid oil and gas leases by them to H. K. Dougherty dated June 15, 1939, recorded in Book 24M, Page 448, reference to which is hereby made for the terms thereof; and also subject to the terms and conditions of the Contract dated January 26, 1939, between Carl Weiner and John G. Kienzle as first parties and H. K. Dougherty as second party as modified by supplemental contract dated April 20, 1939, between the same parties concerning the aforesaid leases.
"That for the same consideration, and as a part hereof, the Assignor, Grant *494& Mohan Oil Company, hereby assigns to _ the said Contract of January 26, 1939, and the said Supplemental Contract of April 20, 1939, and all rights thereunder, between Carl Weiner and John G. Kienzle and H. K. Dougherty with respect to the aforesaid leases; and the Assignee,_ hereby assumes all the obligations thereof, and agrees to perform the same according to the terms and conditions and the tenor thereof.”
This assignment was duly recorded on March 19,1945.
In January, 1945, effective January 15, 1945, Grant & Mohan Oil Company and Frank Young executed and delivered to the oil purchaser their transfer orders setting over to Frank Young the proceeds from the oil produced and sold under the 3/4ths working interest (being the same as 6/7ths of 7/8ths working interest).
On November 15, 1946, Frank Young assigned said leases to C. L. Keas and Kenneth C. Keas, partners, d/b/a Keas Drilling Company, which assignment contained the exact special provision last above quoted. This assignment was duly recorded on November 29, 1946.
On November 16, 1946, effective November 16, 1946, Frank Young and Keas Drilling Company executed and delivered to the oil purchaser their transfer orders setting over to Keas Drilling Company the proceeds from the oil produced and sold under the 3/4ths working interest.
On October 1, 1955, C. L. Keas and Kenneth C. Keas, partners, d/b/a Keas Drilling Company, assigned said leases to Keas Drilling Company, Inc. This assignment was duly recorded on November 30,1955.
It should perhaps be noted, as a matter of clarification, that during the month of November, 1958, one of the five leases here involved was abandoned and no further production was had from it. However, the four remaining leases have continued to produce.
On November 15, 1961, Keas Drilling Company, Inc. assigned the entire 7/8ths working interest in and to said leases to Wilshire Oil Company of Texas, defendant (appellant) “subject to the rights of Carl Weiner and John G. Kienzle, ... if any.” This assignment was duly recorded on December 5,1961.
Wilshire entered into possession of the leases in December, 1961, continued its operation, and retained and continues to retain the proceeds from oil produced and sold under the entire 7/8ths working interest.
Plaintiffs, on April 18, 1962, filed this action for a declaratory judgment, seeking a decree that they were and are entitled to the *495proceeds from l/7th of 7/8ths of the oil produced, saved and sold from said leases.
Execution and delivery of the several assignments and transfer orders as heretofore noted were admitted by the parties and accepted in evidence, but their materiality was not conceded. Weiner and Kienzle waived any objection to materiality and competency. No parol testimony was presented to the trial court.
Weiner and Kienzle admitted that Dougherty was no longer the operator of the leases — “that he may have operated for some period of time for a principal after his assignment to the Kirby Oil Company in July, 1939, but the plaintiff [s] did not have any information as to the exact date he ceased his actual operation for a principal.”
On July 11, 1962, the trial court entered judgment in favor of plaintiffs, decreeing that plaintiffs’ l/7th of 7/8ths overriding royalty in the oil and gas leases is in full force and effect, and that defendant should account to plaintiffs therefor.
Defendant’s motion for new trial was duly filed and was overruled. Appeal has been duly perfected.
Subsequent to the filing of an appeal in this court Kienzle died and the action was revived in the name of Howard Bowker, the administrator of his estate.
In actions founded upon written instruments, where the rights of parties relative to the terms thereof are in controversy, certain fundamental legal concepts permeate the law, and with minor variations it matters not whether the instrument be a contract, a deed or a will.
The doctrine has been well established and frequently applied that where parties have carried on negotiations, and have subsequently entered into an agreement in writing with respect to the subject matter covered by such negotiations, the written agreement constitutes the contract between them and determines their rights. (Arensman v. Kitch, 160 Kan. 783, 789, 165 P. 2d 441; Hudson v. Riley, 104 Kan. 534, 539, 180 Pac. 198; Hudson State Bank v. Haile, 130 Kan. 322, 286 Pac. 228; Grantham v. Hanenkratt Lead & Zinc Co., 131 Kan. 535, 542, 292 Pac. 757; Continental Supply Co. v. Morgan, 133 Kan. 121, 123, 298 Pac. 790; and McKay v. Clark, 162 Kan. 653, 659, 178 P. 2d 679.)
It is a judicial function to interpret a written contract which is free from ambiguity and does not require oral testimony to determine its meaning. Ambiguity in a written instrument does not *496appear until the application of pertinent rules of interpretation to the face of the instrument leaves it genuinely uncertain which one of two or more meanings is the proper meaning. (Klema v. Soukup, 175 Kan. 775, 267 P. 2d 501.) If a written contract is actually ambiguous concerning a specific matter in the agreement, facts and circumstances existing prior to and contemporaneously with its execution are competent to clarify the intent and purpose of the contract in that regard, but not for the purpose of varying and nullifying its clear and positive provisions. (Maltby v. Sumner, 169 Kan. 417, 219 P. 2d 395; Oliver v. Nugen, 180 Kan. 823, 308 P. 2d 132; Custom Built Homes Co. v. State Comm. of Rev. and Taxation, 184 Kan. 31, 334 P. 2d 808; and Dearborn Motors Credit Corporation v. Neel, 184 Kan. 437, 337 P. 2d 992.)
In placing a construction on a written instrument reasonable rather than unreasonable interpretations are favored by the law. Results which vitiate the purpose or reduce the terms of the contract to an absurdity should be avoided. The meaning of a contract should always be ascertained by a consideration of all the pertinent provisions and never be determined by critical analysis of a single or isolated provision. (Tate v. Stanolind Oil & Gas Co., 172 Kan. 351, 240 P. 2d 465; Brooks v. Mull, 147 Kan. 740, 78 P. 2d 879; and Heckard v. Park, 164 Kan. 216, 188 P. 2d 926. It is not the province of the court to make contracts for the parties. Its function is confined to an interpretation of the contract which the parties have entered into. Every presumption is in favor of the legality of a contract rather than its illegality. (Mosher v. Kansas Coop. Wheat Mkt. Ass'n., 136 Kan. 269, 15 P. 2d 421; and Geier v. Eagle-Cherokee Coal Mining Co., 181 Kan. 567, 313 P. 2d 731.)
Prior to a resort to extrinsic evidence, the instrument is to be interpreted from its “four corners.” That is to say, all the language used anywhere in the instrument should be taken into consideration and construed in harmony with other portions of the instrument. (Skelly Oil Co. v. Cities Service Oil Co., 160 Kan. 226, 231, 160 P. 2d 246; Heckard v. Park, supra; and Smith v. Russ, 184 Kan. 773, 339 P. 2d 286.)
Are the contract and assignment ambiguous on the question of the duration of the overriding royalty interest?
Two portions of the contract seem to apply: (a) “This overriding royalty interest shall continue so long as Dougherty operates the properties hereunder;” and (b) “all the terms, covenants, stipu*497lations and agreements herein contained shall extend to and bind the heirs, executors, administrators, successors and assigns of the respective parties.”
The appellant (Wilshire) in the instant case contends the written contract is clear and unambiguous. It argues provision (a) above contemplates the actual operation of the leases by Dougherty; that any other construction would render this phrase meaningless; and that the appellees have admitted Dougherty no longer operates the properties. Accordingly, it is argued, the appellees’ interest has terminated. (Citing Smith v. Holmes, 181 Kan. 438, 312 P. 2d 228.)
The trial court found the contract and assigment not to be ambiguous, and in its memorandum, among other things, said:
“My decision is made with all the above principles in mind and by applying the fundamental rule that the instruments must be read in their entirety to determine their intention and legal effect, from the four comers, as courts have said, and considering all portions together. I have no hesitancy in holding that the overriding royalty reserved to plaintiffs is effective so long as Dougherty and his assigns operate the properties under the leases. Inasmuch as the contracts are specifically made assignable and the first paragraph of each instrument contains the recital, ‘party of the second part, hereinafter referred to as Dougherty’, the name Dougherty is simply an identification, and all references to him throughout the contracts apply fully to his assignees, as Paragraph 9 of the original contract states in unmistakable terms.”
The appellees adopt the reasons set forth by the trial court in its finding that the contract is not ambiguous, and that the overriding royalty interest is a continuing one. They contend, however, that they are not bound to adopt a theory or contention that the contract and assignment are or are not ambiguous; that:
“. . . The question of ambiguity goes to the test of materiality of evidence offered outside the terms of the instruments themselves, such evidence being material if the court first finds the contract and assignment to be ambiguous, and being immaterial if the court first finds the contract and assignment to be not ambiguous. The means employed by the court to determine the intention of the contracting parties varies according to the prior determination by the court of the absence or presence of ambiguity in the terms of the contract and assignment.”
When the “four comers” rule is applied to determine the intention of the parties to the contract and assignment herein, it leads to the conclusion that the overriding royalty interest reserved extends to the assigns of the contracting parties, in accordance with the reasons set forth by the trial court. Obviously, Dougherty had the right under the contract to assign and remove himself absolutely from any connection with the leases, and he could have done *498so the day following the assignment of the leases to him pursuant to the contract. Was it within the contemplation of the parties that the overriding royalty interest could be so easily terminated?
Can it be successfully argued that Dougherty’s personal operation of the leases was a condition necessary to the continued existence of the overriding royalty interest, when other provisions relating to obligations of payment for the balance of the purchase price, the giving of notice of intention to abandon the leases for nonprofitable operation, and the payment of gross production taxes all extended to the assigns of Dougherty?
In the court’s opinion the foregoing questions must be answered in the negative. Application of the foregoing rules to the written contract and the assignment of the leases to Dougherty lead to the conclusion that there is no ambiguity in the written instruments— that the overriding royalty interest reserved to Weiner and Kienzle is binding upon Dougherty and his assigns.
The appellant’s contention that the language “so long as” creates a base or determinable fee (citing authorities), has no application. Cases relied upon by the appellant disclose that in each instance the instrument was a conveyance of oil and gas in place and real property law was applied. In the instant case, the subject matter is an overriding royalty interest, the right to receive money, a chose in action, and not an interest in real property. (Connell v. Kanwa Oil, Inc., 161 Kan. 649, 170 P. 2d 631; and Denver National Bank v. State Commission of Revenue & Taxation, 176 Kan. 617, 272 P. 2d 1070.)
The judgment of the lower court decreeing the appellees’ undivided l/7th interest in all oil and gas produced and saved from the 7/8ths working interest in the oil and gas leases, known as an overriding royalty, to be in full force and effect, thus calling for the appellant to account to the appellees therefor, is affirmed.
Jackson and Fontron, JJ., not participating.