
511 S.W.2d 141 (1974)
STATE of Missouri ex rel. SISTERS OF ST. MARY, a corporation, Relator,
v.
Hon. Robert Lee CAMPBELL, Judge of the Circuit Court, County of St. Louis, Division Fifteen, and His Successors as Judges of Said Division, Respondent.
No. 35784.
Missouri Court of Appeals, St. Louis District, Division 1.
June 11, 1974.
*143 Moser, Marsalek, Carpenter, Cleary, Jaeckel, Keaney & Brown, St. Louis, for relator.
Shepherd & Weenick, Clayton, for respondent.
SIMEONE, Judge.
This is an original proceeding in prohibition in which the relator, Sisters of St. Mary, a corporation organized under the provisions of Chapter 352, RSMo, V.A.M.S. seeks to prohibit the respondent-judge "and his successors in office" from proceeding further in a cause of action for damages filed by Monty Smoot as plaintiff against the relator-defendant. Art. V, § 4, Mo.Const., V.A.M.S.
On July 6, 1973, Monty Smoot, husband of Sally A. Smoot, filed a petition in the circuit court of St. Louis County alleging the following pertinent facts:
1. That on or about January 25, 1968, his wife Sally, then being approximately seven months pregnant, was admitted as a patient to St. Mary's Hospital operated by the Sisters of St. Mary.
2. At the time of her admission, Sally was in convulsions due to "insulin reactions."
3. That upon admission to the hospital Sally was "received ... and assigned to an intensive care unit ... where the said hospital had contracted with plaintiff to supply intensive and continuously monitored care...."
4. While in the hospital and on January 27, 1968 Sally "did begin pre-delivery labor."
5. That then and thereafter there were "no nurses or other attendants ... and no nurse or other attendant was available or in attendance on the hallways or at the nursing stations ... and that, as a result of the breach of contract by failure to provide nursing attendance or care and the failure to provide interns, residents... plaintiff [Monty] was required to push the bed of ... [Sally] out into the public hallway with ... the child partially delivered ... and take... [Sally] to the obstetrical department... at which place [Monty] and a nurse, without other medical assistance completed the delivery ... of the child of the plaintiff [Monty]."
"6. That as a result of the breach of contract by the defendant ... within 24 hours of the birth of the child ... the ... child died."
"7. That the death of the child ... directly occurred as a result of the breach of contract of defendant in not providing proper medical attendants, proper nursing services and the intensive care and attention ... and for which service ... plaintiff and defendant had contracted."
"8. That as a result of the said breach of contract by the defendant ... *144 plaintiff has been damaged in the sum of $50,000.00 and has been required to pay moneys to defendant under threat of suit in the amount of $516.00 and further ... required to hire an attorney to defend the petition of defendant in a separate collection action and pay said attorney therefor the sum of $125.00, all to plaintiff's great damage in the sum of $50,651.00 [$50,641.00?]."
The prayer concluded: "Wherefore... plaintiff prays judgment against defendant for this breach of contract and his consequential damages ... in the sum of $50,641.00 plus the costs...." (Emphasis added.)
On July 24, 1973, Relator, through counsel, filed its motion for summary judgment under Rule 74.04 alleging, "Under the law of Missouri, there is no cause of action for wrongful death based on breach of contract," and alleging that the petition "although alleging it is a cause of action for breach of contract is in fact and in truth an alleged cause of action for wrongful death and on the face of the petition said cause was not filed within two years of the alleged wrongful act ... and... is barred by ... Sections 537.080 and 537.100, R.S. Missouri." The motion also alleged that since relator was and is a charity, it is immune "from suits... for damages for alleged neglect, failures or negligence, which alleged cause of action arose prior to November 10, 1969...."
On October 22, 1973, the respondent overruled the motion for summary judgment.
On October 31, 1973, relator filed its petition for prohibition seeking to restrain respondent from proceeding further in the cause of Monty Smoot v. Sisters of St. Mary. After receiving suggestions, we issued our preliminary writ on December 7, 1973, and the parties filed their return, answer and reply respectively. The return filed by respondent (1) admitted, "Relator would not be liable for an action grounded in malpractice, tort, wrongful death, or any other root word description of a tort action... but Respondent ... assets [sic] affirmatively that said cause states a cause of action solely in contract;" (2) that he has stated a "cause of action wherein he has alleged the existence of a good and valid contract, a breach thereof by nonperformance on the part of the Sisters of St. Mary, damages flowing from said breach and thereupon states a cause of action entitling him to be heard...;" (3) that "while the items and amounts of damage allegedly suffered by plaintiff in our Circuit may be subject to proof, he has stated a cause of action sounding in contract...." The cause therefore was "timely filed" under § 516.120 because Monty Smoot did not attain his majority until December 10, 1970; (4) that relator has the right of appeal from any judgment issued against it and accordingly prohibition should not issue; (5) that relator's action is untimely since respondent has already ruled on the motion for summary judgment against relator; (6) that relator's action is misdirected to respondent because the action is pending in the assignment division under the direction of the presiding judge and not respondent, and (7) relator's remedy at law is adequate, since the cause of action is "clearly grounded in contract and seeks various damages flowing from the breach alleged thereof.... His damages assertion or allegation is subject to proof and Relator will have its day in contravention of such proof. Following that, its rights of appeal will be for such errors as the Circuit Court may have permitted to occur."
Further refining his objections to the issuance of the writ, respondent states that relator contends:
1. The petition is not really a suit on contract.
2. The motion for summary judgment is really a motion to dismiss.
3. The motion for summary judgment did not admit facts.
*145 4. That although respondent returned the file to the presiding judge, respondent should be considered to be one and the same as the presiding judge.
It appears also that the facts have these additional elements. As stated, it was alleged that Sally Smoot entered the hospital on or about January 25, 1968; on January 27, 1968 she began pre-delivery labor; the child died within twenty-four hours thereafter. On January 12, 1973 (some four years and 352 days later) the relator filed suit in the magistrate's court in the amount of $349.65 for the services rendered. Monty Smoot filed a counterclaim seeking damages in the amount of $50,000 for breach of contract and that he was required to pay $516 under threat of suit and to hire an attorney for $125. Because the counterclaim was in excess of jurisdiction, the cause was certified to the circuit court which dismissed the counterclaim because not filed within 20 days after the return date of the summons. § 517.240, RSMo. Monty Smoot then dismissed the counterclaim and filed his petition stated above in the circuit court.
In 1968 Monty Smoot was a minor; he did not reach his majority until December 10, 1970, hence respondent urges that Smoot's action was brought within the proper time under § 516.120, RSMo, V.A.M.S.  five year statute for breach of contract after he reached his majority.
Relator in its brief makes the following points in urging us to make our preliminary writ permanent:
1. Although the plaintiff-Smoot frames his petition in words alleging a breach of contract, the legal effect of his claim for "failure to provide nursing attendance or care and the failure to provide interns, residents or other medical doctors" is in reality an action of "malpractice" (a) which makes relator immune since any such action arose prior to November 10, 1969 [Abernathy v. Sisters of St. Mary's, 446 S.W.2d 599, 606 (Mo. banc 1969); Garnier v. St. Andrew Presbyterian Ch. of St. Louis, 446 S.W.2d 607, 608 (Mo. banc 1969)], and (b) which is barred by the statute of limitations under § 516.140, RSMo, V.A.M.S.;
2. Even though the petition sounds in contract, there is no valid cause of action for wrongful death based on a breach of contract; and
3. Prohibition is the proper remedy to restrain respondent.
Respondent on the other hand contends that (1) prohibition is not the proper remedy under § 530.010, RSMo, V.A.M.S. and Rule 97 because prohibition is to prevent usurpation of power; respondent has jurisdiction to entertain the merits of the cause, and relator's remedy at law is adequate and effective; (2) that the entire argument of relator that the petition is in reality one of malpractice or one for wrongful death is "inapplicable" and (3) fundamental fairness "demands that the writ of prohibition herein should be denied."
We are required to construe the petition filed by the plaintiff favorably to him and give him the benefit of every reasonable and fair intendment in view of the facts alleged, and if the pleader's allegations invoke principles of substantive law which may entitle him to relief, the petition is not to be dismissed, and if the facts pleaded and the reasonable inferences to be drawn therefrom looked at most favorably from the plaintiff's standpoint show any ground for relief, the plaintiff has the right to proceed. Ingalls v. Neufeld, 487 S.W.2d 52, 54 (Mo.App.1972); Young v. Lucas Construction Company, 454 S.W.2d 638, 641 (Mo.App.1970).
The plaintiff has framed his petition in contract alleging a breach for the "failure to provide nursing attendance or care and the failure to provide interns, residents, or other medical doctors ... [t]hat as a result of the breach of contract ... the child died ... [and] that the death ... occurred as a result of the breach of contract ... in not providing *146 proper medical attendants, proper nursing services and the intensive care and attention appropriate ..." Smoot therefore prayed damages in the sum of $50,000[1] plus amounts he was required to pay under threat of suit.
After reading the entire record, the briefs, suggestions and authorities cited by the parties, we are convinced that under the circumstances of this case, plaintiff-Monty Smoot is not entitled to maintain this action for damages for "failure to provide attendance or care" against relator because (a) the action is barred by the statute of limitations, § 516.140 and (b) the relator at the time of the alleged failure to provide attendants and care, January, 1968, was immune.
Although Smoot has used the words "breach of contract"[2] in his petition and has framed his petition in such terms, the legal effect of it is to seek damages for failure to provide medical and nursing attendance and care so that as a result his child died.
Therefore, the basic and core issue as we view it is whether any action for damages may be maintained against the hospital for its failure to provide "proper medical attendants, proper nursing services and the intensive care and attention" whatever its theory, whatever its name or whatever the allegations of the petition. The basic issue is not how the petition is framed, but is one of policy as determined by our general assembly as to whether any action for damage for failure, neglect, error or mistake in the care and treatment of a patient at a hospital may be maintained after two years as proscribed by § 516.140.
The general assembly has proscribed generally that all ordinary actions of contract or tort must be maintained within five years. This general statute of limitations relating to such actions is § 516.120. That section requires that all actions "upon contracts, obligations or liabilities, express or implied, except those mentioned in section 516.110 ..." must be brought within five years.
But the general assembly has carved out of this general statute certain actions against certain persons and entities mentioned in § 516.140, including hospitals: "All actions against ... hospitals... for damages for malpractice, error, or mistake shall be brought within two years from the date of the act of neglect complained of...." (Emphasis added.)[3]
Our general assembly therefore has, in our opinion, determined that all actions against hospitals for damages allegedly due to malpractice, error, mistake, neglect or failure to provide proper service must be brought within the time specified whether the action is denominated a "tort" or "breach of contract."
Therefore, we hold that the petition filed by Monty Smoot against the hospital, although framed in terms of breach of contract, not having been brought within the *147 time proscribed by § 516.140, after Monty reached his majority cannot be sustained.
This determination that no action for damages may be maintained after two years is supported by Gerba v. Neurological Hospital Association, 416 S.W.2d 126 (Mo.1967). In Gerba, supra, Nancy Gerba sought to recover damages for injuries she received while a patient in defendant hospital. The defense was that the action was barred under § 516.140"[a]ll actions against ... hospitals ... for damages for malpractice, error, or mistake shall be brought within two years from the date of the act of neglect complained of." Our Supreme Court construed the meaning of the word "malpractice", "error", "mistake" and "neglect" and concluded, "When the statute is considered as a whole, and especially with reference to the meaning of the specific words here involved, we think it clearly means that all actions are barred thereby in which damages are sought for any malpractice, error, mistake, or neglect in the care, custody, or treatment of a patient by a hospital." 416 S.W.2d at 128. "Neglect" was defined as meaning "to fail to attend to sufficiently or properly: not give proper attention or care to." 416 S.W.2d at 127 (Emphasis added.) The Court in Gerba specifically held that "all actions ... in which damages are sought for any ... neglect in the care, custody, or treatment of a patient by a hospital" are barred.[4]
As we understand plaintiff-Smoot's position he does not profess to maintain suit under the wrongful death act, § 537.080, for he states, "Defendant concludes [concedes?] that there is no action for wrongful death based on breach of contract," but rather he bases his claim that he has a right to maintain his action for "breach of contract" and recover all damages flowing from such breach against the hospital within five years after the plaintiff's-Smoot's disability is removed.
Plaintiff-Smoot is correct and cannot, of course, maintain an action for wrongful death upon a contract, and a petition seeking to recover damages for the death of his child occurring "as a result of the breach of contract ... in not providing proper medical attendants... and attention appropriate..." cannot state a claim for wrongful death. An action for damages for death does not confer a claim ex contractu but only one ex delicto. Bloss v. Dr. C. R. Woodson Sanitarium Co., 319 Mo. 1061, 5 S.W.2d 367 (1928): "[T]he doctrine in this state always has been that the wrongful death statutes confer a cause of action ex delicto, not one ex contractu." Bloss, supra, 5 S.W.2d at 368; Sterling Aluminum Products v. Shell Oil Co., 140 F.2d 801, 804 (8th Cir. 1944); 25A C.J.S. Death § 27, p. 627 (1966); 22 Am.Jur.2d, Death, § 19 (1965).
Since the damages sought by Smoot against relator are based upon the allegations of "failure to provide" proper nursing or medical attendants or care as a result of which the child died, even though the petition is framed upon the theory of breach of contract and since we believe it to be clear that such action is barred by the two-year statute of limitations under § 516.140, and that the relator at the time the cause occurred was immune from liability, is must follow that the petition filed by *148 Smoot cannot state a claim for relief against relator. Abernathy v. Sisters of St. Mary's, supra; Garnier v. St. Andrew Presbyterian Ch. of St. Louis, supra  abolishing the doctrine of charitable immunity "to all future causes of action arising after November 10, 1969...." Abernathy, supra, 446 S.W.2d at 606.
We are sympathetic to the plaintiff's-Smoot's position. But a legislative declaration of public policy has been made to carve out of the general statutes of limitations (§ 516.120), specific limitations (§ 516.140) relating to hospitals and to require that actions against such entities be filed within the proscribed time. A statute of limitations established by legislative declaration "not only ... [encourages] citizens to seasonably file and to vigilantly prosecute their claims for relief, but also... require[s] them to do so or, otherwise, find their claims proscribed by law." State v. Robertson, 417 S.W.2d 699, 701 (Mo.App.1967). It has often been pointed out that statutes of limitations rest upon reasons of sound public policy in that they tend to promote the peace and welfare of society and are favored in the law, and cannot be avoided unless the party seeking to do so brings himself strictly within some exception. Baron v. Kurn, 349 Mo. 1202, 164 S.W.2d 310, 142 A.L.R. 787 (Mo.1942). See also 1 Wood. Limitations of Actions 1-12 (4th ed. 1916).
The next issue is whether prohibition is the proper remedy to restrain respondent from proceeding further in the cause.
Respondent contends that prohibition should not issue because (1) respondent had jurisdiction to act on the motion for summary judgment and did not exceed its jurisdiction, (2) that relator's remedy on appeal is adequate and effective, (3) that the proceeding in prohibition is untimely since respondent has ruled on the motion, (4) that relator's action is misdirected to respondent because the action is pending in the assignment division rather than with respondent.
The essential function of the writ of prohibition is to confine a lower court within its proper jurisdiction and prevent it from acting without or in excess of its jurisdiction. It is not the function of the writ to control a trial court's discretion or direct how it may be exercised. State ex rel. Allen v. Yeaman, 440 S.W.2d 138, 145 (Mo.App.1969). The writ is properly invoked to restrain the enforcement of orders beyond or in excess of the authority of the judge, and to keep a court within the compass of its jurisdictional action as defined by law. State ex rel. Houser v. Goodman, 406 S.W.2d 121, 127 (Mo.App.1966); Rule 97, Chapter 530, RSMo, V.A.M.S.
While it is true that the general principle is that prohibition will not lie when the act has already been performed, or that the writ cannot be a substitute for an appeal, State ex rel. Berbiglia, Inc. v. Randall, 423 S.W.2d 765 (Mo. banc 1968), or to control discretionary acts, these principles have their limitations and exceptions.
In State ex rel. National Refining Co. v. Seehorn, 344 Mo. 547, 127 S.W.2d 418 (1939), a husband brought an action for loss of consortium when his wife was injured. The husband died before the cause went to trial and his administrator filed a petition for such damages. Relator, National Refining, objected. The issue was raised whether prohibition was the proper remedy. In ruling on this question and holding that prohibition was proper because the administrator had no right or authority to proceed, the court stated [quoting from State ex rel. Johnson v. Sevier, 339 Mo. 483, 98 S.W.2d 677, 680 (banc 1936)], "`But, where a petition reveals that the pleader has not stated, and cannot state, a cause of action of which the circuit court would have jurisdiction, then prohibition will lie.'" 127 S.W.2d at 425.
That is the situation here. The plaintiff cannot maintain an action for damages resulting in the death of his child, and the immunity of the relator at the time *149 of the tragic death of the child bars such action, hence the respondent exceeded his jurisdiction in overruling the motion for summary judgment.
Appeal in this instance would not be an adequate remedy  appeal would not prevent the expense and vexation of going through a trial when the court has exceeded its jurisdiction. State ex rel. National Refining Co. v. Seehorn, supra, 127 S.W.2d at 425; State ex rel. Siegel v. Strother, 365 Mo. 861, 289 S.W.2d 73 (banc 1956).
Respondent contends that the writ is misdirected to respondent because the action is now lodged with the assignment division of the court under the direction of the presiding judge and not respondent. We hold the writ was not misdirected. In State ex rel. Siegel v. Strother, supra, respondent contended that he was not the proper party because he had no jurisdiction to act further in the cause since the cause was transferred to the General Docket and jurisdiction was in the presiding judge. The Supreme Court held that it is the practice in the issuance of writs to direct writs to the judge who made the order challenged, but that by service of the preliminary writ upon such respondent, jurisdiction is acquired over the circuit court. Strother, supra, 289 S.W.2d at 78-79[9]. The court also rejected a contention of respondent that the writ would not lie "because the action taken by respondent was complete and there was nothing further to be done," and held, "Prohibition is available and proper where a court is proceeding in excess of its jurisdiction and something further is to be done pursuant thereto." 289 S.W.2d at 79.
Respondent also obliquely contends that relator is in error in filing a motion for summary judgment and should have filed a motion to dismiss under Rule 55.27 for "failure to state a claim upon which relief can be granted."
Civil Rule 74.04 provides for summary judgment if the pleadings, depositions, and admissions on file show that there is no genuine issue as to any fact and that the moving party is entitled to judgment as a matter of law. The burden is upon movant to show by unassailable proof that there is no genuine issue as to a material fact and that he is entitled to judgment as a matter of law. Weber v. Les Petite Academies, Inc., 490 S.W.2d 278, 279 (Mo.App.1973); Porter v. Georgia Casualty & Surety Company, 508 S.W.2d 27 (Mo.App.) St. Louis District, 1974.
We believe that in this instance a motion for summary judgment was proper. Since "a motion for summary judgment may be made solely on the pleadings, when it is so made it is functionally the same as a motion to dismiss or a motion for judgment on the pleadings." 6 Moore's Federal Practice, § 56.03[3] at 2035 (1974). When, therefore, the motion for summary judgment addresses itself to the pleadings for failure to state a claim it performs the same function as the motion to dismiss. And where the pleadings show no genuine issue as to material facts, summary judgment is proper. Sam Kraus Company v. State Highway Commission, 416 S.W.2d 639, 641 (Mo.1967). When plaintiff's action is barred by the statute of limitations, a motion for summary judgment properly presents the defense and should be granted. Gruenewalder v. Wintermann, 360 S.W.2d 678, 690 (Mo.1962). There is no genuine issue of material fact.
The last contention of respondent is that "fundamental fairness demands that the writ of prohibition be denied" because the position urged by relator would result in holding that Mr. Smoot's cause of action would expire two years after December 10, 1970 (when Smoot attained his majority) and yet the relator-hospital would have a claim for the value of its alleged services for five years or until January 25, 1973. "This is to say that the position of Relator is to limit Mr. Smoot to a two year Statute of Limitations when it in fact can take advantage of five year Statute of Limitations. *150 There is still the cause of action of Relator pending in the Magistrate Court in St. Louis County for the value of its services as alleged.[5] Mr. Smoot was denied the opportunity to present his counterclaim in that court by reason of a 10 day [sic 20 days§ 517.240] procedural time limitation.... Relator seeks to deny him his day in court there [circuit court] just as it sought to deny him his day in court in the Magistrate Court. The Relator wants to take advantage of a five year Statute of Limitation and deny Mr. Smoot the opportunity to respond in a way that effectively states the true amount of his damages."
Our response is two-fold. First, the differences in the limitations of time within which to bring actions has been determined by the wisdom of our General Assembly. We are bound by such differences between the time limitations set forth in §§ 516.140 and 516.120; cf. Laughlin v. Forgrave, 432 S.W.2d 308 (Mo. banc 1968). The argument of respondents is more properly directed to the General Assembly rather than to this court.
Secondly, the hospital may not be entitled to recover for services which were not rendered, because the defense of recoupment may be available to Smoot in an action brought by relator for services rendered, notwithstanding the fact that Smoot cannot affirmatively seek damages for the "failure to provide nursing attendance...." which resulted in the death of the child. "By the defense of recoupment, defendant seeks to cut down plaintiff's claim upon proof of defective performance. Recoupment goes to mitigation or extinguishment of plaintiff's damages but permits no affirmative judgment for the defendant." Edmonds v. Stratton, 457 S.W.2d 228, 232 (Mo.App.1970). Therefore, if the cause by relator is pending, and Smoot may recoup any damages suffered by reason of the failure to provide proper attendance, there is no injustice to Mr. Smoot.
Therefore, having disposed of all the points and issues raised by the parties, we conclude that the respondent acted in excess of its jurisdiction in overruling the motion for summary judgment and our preliminary writ heretofore issued should be made permanent.
The preliminary writ heretofore issued is made permanent.
DOWD, C. J., and KELLY, J., concur.
NOTES
[1]  § 537.090, RSMo, V.A.M.S. before amended in 1973 provided that damage for wrongful death was limited to $50,000.
[2]  The borderline between contract and tort can be very imprecise and nebulous which is not surprising in view of the fact that much of the common law of both tort and contract can be traced to one source. Plucknett, A Concise History of the Common Law 637 (5th ed. 1956). As a rule, when actions involve elements of both contract and tort, two judicial solutions obtain: the first is to allow plaintiff to choose his ground; the second is to examine the quintessence of the claim and judicially determine it. See generally, Prosser, Torts, 639-43 (1964) and Prosser, The Borderland of Tort and Contract in Prosser, Selected Topics on the Law of Torts 380 (1954); Thornton, The Elastic Concept of Tort and Contract, 14 Brook.L.Rev. 196 (1948).
[3]  It is to be noted that this section is not limited to tort actions for the section also precludes "an action by an employee for the payment of unpaid minimum wages, unpaid overtime compensation or liquidated damages by reason of the nonpayment of minimum wages or overtime compensation...."
[4]  In Barnhoff v. Aldridge, 327 Mo. 767, 38 S.W.2d 1029, 74 A.L.R. 1252 (1931), plaintiff sought damages against a physician resulting from surgery. Plaintiff framed her petition in contract. The Supreme Court held that the statute of limitations (§ 516.140) and not the statute of limitations on contract (§ 516.120) was applicable. "We think it is obvious that, though the petition ... alleges an express contract between the parties, the gravamen or gist of the action is defendant's wrongful act.... The statute invoked is a bar to all actions against physicians... for damages...." 38 S.W.2d at 1030. This is the general rule, although the complaint is "in form an action on contract." Annot., 74 A.L.R. 1256, 1257 (1931), See also National Credit Associates, Inc. v. Tinker, 401 S.W.2d 954 (Mo.App.1966).
[5]  In Smoot's petition he has stated that he has paid the sum of $516.00 under threat of suit. Quere?
