
222 P.2d 1085 (1950)
54 N.M. 296
NEWBOLD
v.
FLORANCE.
No. 5298.
Supreme Court of New Mexico.
October 9, 1950.
Dudley Cornell, Albuquerque, for appellant.
M.A. Threet, Sam Dazzo, both of Albuquerque, for appellee.
COMPTON, Justice.
The present appeal is from an order striking appellant's amended complaint. The original complaint contained two counts; the first cause of action was on account stated and the second cause of action was based on quantum meruit. In substance, the complaint alleged that appellant was the procuring cause of the sale of oil and gas properties, or interest therein, by appellee to the Wood River Oil & Refining Co., Inc., for a consideration of $250,000.00 and that the reasonable value of his services therefor was $12,500.00; that appellant and appellee agreed upon the value of such services at $8,200.00, and to be paid in the following manner: $1,000.00 cash and $300.00 monthly for three years, on which appellee paid the sum of $500.00 leaving a balance of $7,700.00 due appellant. Appellee entered a general denial thereto and also asserted a legal defense "that the complaint fails to state a claim upon which relief can be granted." By counterclaim he sought to recover judgment for $500.00 for money allegedly loaned appellant. Concurrently with the filing of the answer and counterclaim appellee submitted interrogatories which were answered by appellant and admitted in evidence. The depositions of Edna Newbold, formerly the wife of appellant, and Fred C. Koch, president of Wood River Oil & Refining Co., Inc., were likewise admitted in evidence.
Appellant testified in response to the interrogatories propounded to him that there was neither a written contract covering his services nor was there an agreement as to compensation therefor, and that he elected to stand on the first cause of action; whereupon, appellee moved for a dismissal of the complaint. The court, treating the motion to dismiss as a motion for summary judgment, granted the motion for the stated reason, "that plaintiff's complaint fails to state a claim upon which relief can be granted against the defendant and in favor *1086 of the plaintiff upon an account stated."
Appellant was granted leave to file an amended complaint. The amended complaint alleges that there existed a bona fide dispute between appellant and appellee with respect to payment for services rendered by him in the sale of oil and gas producing properties, or interest therein, by appellee to the said Wood River Oil & Refining Co., Inc.; that such disputed claim was settled by compromise agreement whereby appellee agreed to pay appellant $8,200.00 in the following manner: $1,000.00 cash and the balance $300.00 monthly for a period of three years. The amended complaint further alleges that appellee paid $500.00 thereon leaving a balance due of $7,700.00 which he refuses to pay and judgment is asked accordingly. Appellee again interposed a motion to dismiss on the ground that the amended complaint was merely repetitious of matters and things pleaded in the original complaint, and such matters having been previously disposed of on the merits, the same is res judicata. From an order sustaining the motion appellant brings the matter here for review.
A safe test in applying the doctrine of res judicata is stated at 30 Am.Jur. (Judgments), § 174, as follows:
"In the application of the doctrine of res judicata, if it is doubtful whether a second action is for the same cause of action as the first, the test generally applied is to consider the identity of facts essential to their maintenance, or whether the same evidence would sustain both. If the same facts or evidence would sustain both, the two actions are considered the same within the rule that the judgment in the former is a bar to the subsequent action. If however, the two actions rest upon different states of facts, or if different proofs would be required to sustain the two actions, a judgment in one is no bar to the maintenance of the other. It has been said that this method is the test and most accurate test as to whether a former judgment is a bar in subsequent proceedings between the same parties, and it has even been designated as infallible. * * *"
We are of the opinion that the trial court committed error. Neither the doctrine of res judicata nor the doctrine of the law of the case is applicable. While the evidence required to support both causes of action may in part be the same, the subject matter is essentially different. The amended complaint is based upon contract, not upon account stated as previously alleged. For a discussion of the doctrine of res judicata, see: Paulos v. Janetakos, 46 N.M. 390, 129 P.2d 636, 142 A.L.R. 1237; McCarthy v. Kay, 52 N.M. 5, 189 P.2d 450; Carroll v. Bunt, 50 N.M. 127, 172 P.2d 116. The specific question raised by the amended complaint is whether disputed claims were settled by compromise agreement, not what the rights of the parties were in the original controversy. Armijo v. Henry, 14 N.M. 181, 89 P. 305, 25 L.R.A., N.S., 275; Frazier v. Ray, 29 N.M. 121, 219 P. 492; Tocci v. Albuquerque & Cerrillos Coal Co., 45 N.M. 133, 112 P.2d 515; Donald v. Davis, 49 N.M. 313, 163 P.2d 270.
Sec. 19-101, Rules of Civil Procedure, rule (8) (e) (2), in part provides:
"A party may set forth two or more statements of a claim or defense alternatively or hypothetically, either in one count or defense or in separate counts or defenses. When two or more statements are made in the alternative and one of them if made independently would be sufficient, the pleading is not made insufficient by the insufficiency of one or more of the alternative statements. A party may also state as many separate claims or defenses as he has regardless of consistency and whether based on legal or on equitable grounds or on both. * * *" (Emphasis ours.)
The foregoing is an adaptation of rule (8) (e) of the Federal Rules of Civil Procedure, 28 U.S.C.A. The following are but a few of the cases supporting the rule: Bremen Mining & Milling Co. v. Bremen, 13 N.M. 111, 79 P. 806; Hudson v. Herschbach Drilling Co., 46 N.M. 330, 128 P.2d 1044; Foster Wheeler Corporation v. American Surety Co., D.C.N.Y., 25 F. Supp. 700; Kraus v. General Motors Corporation, D.C.N.Y., 27 F. Supp. 537; Cary v. Hardy, D.C.Tenn., 1 F.R.D. 355; Bicknell v. Lloyd-Smith, D.C.N.Y., 25 F. Supp. 657.
*1087 Undoubtedly, a separate count alleging compromise and settlement could well have been stated in the original complaint. This being true it is as logical to say that an amended complaint alleging the same ultimate facts should withstand a motion to dismiss. Clearly, appellant at first mistook his remedy but amendments are favored and should be liberally construed in the futherance of justice. Bremen Mining and Milling Company v. Bremen, supra. Moreover, subsection (f) of the rule provides that "All pleadings shall be so construed as to do substantial justice." The cases support the rule. A new cause of action may be alleged in an amended complaint, provided it is founded on facts not wholly foreign to the facts originally pleaded. Cole v. Casabonne, 39 N.M. 171, 42 P.2d 1115; Hudson v. Herschbach Drilling Co., 46 N.M. 330, 128 P.2d 1044.
The judgment will be reversed with directions to the trial court to reinstate the case upon its docket, enter an order overruling the motion to strike the amended complaint and proceed in a manner not inconsistent herewith. And it is so ordered.
BRICE, C.J., and LUJAN, SADLER, and McGHEE, JJ., concur.
