This is an appeal from a judgment affirming an order of the Public Service Commission (P.S.C.) that directed repairs to and reconstruction of certain viaducts over tracks of Kansas City Terminal Railway Company (Terminal) and apportioned the costs thereof between Terminal and Kansas City (City). An opinion affirming that judgment was written in Division I. On the court’s own motion, the case was then transferred to the court en banc. After reargument, the divisional opinion failed of adoption and the case is now written on reassignment. We reverse and remand with directions.
No issue is raised as to the right of the P.S.C. to direct the work on the viaducts. The question to be determined is whether the cost thereof is to be borne by Terminal pursuant to a prior contract between it and City wherein Terminal agreed to assume all such expense or whether that contractual provision was abrogated by adoption of the Public Service Commission Act or by the 1963 amendment of that Act.
In 1909 City and Terminal entered into a contract that awarded Terminal a 200 year franchise for the operation of its system within the city, including the right to use city streets and alleys for that purpose. As part of the agreement City agreed to and did vacate various streets, alleys and public places in order to make right-of-way available for Terminal. One hundred and two such tracts were involved. In return, Terminal assumed certain obligations, including an agreement to bear the expense of construction, maintenance and reconstruction, if necessary, of certain specifically designated viaducts over Terminal’s tracks, plus such other viaducts or subways as might be required during the term of the franchise. This contract was embodied in an ordinance which was submitted to and approved by the voters of Kansas City and then formally accepted by Terminal.1
In 1922 City determined that public necessity required a viaduct over Terminal’s tracks at Oak Street and it called upon Terminal to construct such a viaduct pursuant to provisions of the 1909 contract. Terminal refused to comply, following which a proceeding was instituted before the P.S.C. seeking approval of the proposed viaduct and a direction to Terminal to erect it. The Commission approved the viaduct and directed that Terminal should bear the *857cost of construction and maintenance. Terminal sought review of that order. This court affirmed the order of the P.S.C. insofar as it determined that a viaduct should be constructed at Oak Street in accordance with an approved plan, but reversed the judgment insofar as it allocated the cost of construction and maintenance of the viaduct. State ex rel. Kansas City Terminal Ry. v. Public Service Commission, 308 Mo. 359, 272 S.W. 957 (1925). That opinion held that the decision as to where and when a viaduct should be constructed was one to be made by the P.S.C., but that the Commission should leave for determination in an appropriate forum the interpretation and enforcement of the alleged contract with respect to cost of such viaducts.
Subsequently, City instituted an action in the circuit court to compel Terminal to comply with its contractual obligation to build and pay the cost of the Oak Street viaduct. In Kansas City v. Kansas City Terminal Ry., 324 Mo. 882, 25 S.W.2d 1055 (banc 1929), this court held that the 1909 contract between City and Terminal was a valid contract supported by consideration; that it did not limit, abridge or hamper the exercise of the police power of the state; and that enactment in 1913 of the Public Service Commission Act did not abrogate the 1909 contract or destroy the right of the City thereunder to have viaducts paid for by Terminal. Accordingly, the court directed specific performance of Terminal’s obligation to construct and pay for the Oak Street viaduct.
In 1969 information reaching the P.S.C. caused it to undertake an investigation of the safety of the Prospect Avenue and Main Street viaducts over Terminal’s tracks in Kansas City. Both Terminal and City were ordered to appear and present facts concerning the safety of these viaducts and the Commission ordered the employment of an engineering firm for the purpose of making a study thereof. Meanwhile, in 1970, Terminal made emergency repairs to the Oak Street viaduct and, at its request, that viaduct was included in the P.S.C. proceedings. Terminal filed a motion requesting the P.S.C. to allocate costs between it and the City.2 Before ruling thereon, the Commission ordered Terminal and City to present their agreement on the repairs needed on the various viaducts and allocation of those costs. No agreement was made, the City taking the position that under the 1909 contract Terminal was contractually obligated to pay all of the costs and that the validity of that contract had been established in litigation between the parties in the second Oak Street case.
On March 22, 1972, the P.S.C. issued its report and order in this proceeding. Included therein was this finding:
“This Commission has jurisdiction of this cause under Section 389.640, RSMo 1969, V.A.M.S., to determine the safety of the above mentioned viaducts carrying city streets over railroad tracks, and to order repairs and reconstruction thereof if such are needed, and to allocate the cost thereof.” 3
*858In addition, the P.S.C. order stated:
“City contends that the cost of repairs and reconstruction should be allocated in accordance with the provisions of the Franchise Ordinances of 1909 and 1911, which City asserts are contracts between it and Terminal. Assuming the ordinances are such contracts, they were not entered into after October 13, 1963, and only contracts entered into after that date are binding on this Commission under the terms of 389.640. The Commission is, therefore, obligated to apportion costs in accordance with the factors and standards set out in that statute.”
Having concluded that under amended § 389.640 4 the 1909 contract was not applicable and was not to be applied, the P.S.C. then proceeded to apportion to the City 90 per cent of the cost of the viaduct repairs and engineering with the remaining 10 per cent to be paid by Terminal. The entire cost of reconstruction of the viaducts at Prospect and Main was allocated to the City on the basis that this work was not of any benefit to Terminal.
The City filed application for review of the foregoing order in the Circuit Court of Cole County. That court affirmed the order of the P.S.C. and City appealed.
The City, in seeking reversal of the order allocating costs, relies primarily on the decision of this court in the second Oak Street case. It points out that Terminal and City (the same parties as those herein) there litigated the same question as now raised; namely, did the enactment of the Public Service Commission Act vesting authority in the P.S.C. to allocate costs of railroad crossings necessarily abrogate and super-cede the obligation of Terminal under the 1909 contract to bear all of such costs? City insists that since this court in the second Oak Street case held such contract to be valid and that its provisions as to payment by Terminal for such installations did not interfere with the exercise of the state’s police power and that such provisions were not abrogated by the enactment of the Public Service Commission Act, the issue has been settled.
If that decision stands, it necessarily is decisive of the issue raised by City’s appeal unless, as the P.S.C. and the circuit court held, the amendment of § 389.640 in 1963 has altered the situation. The order of the P.S.C. is based on the premise that it did, and that under the terms of the 1963 amendment only contracts dated after October 13, 1963, may govern how costs may be apportioned. We reject that interpretation, it being our conclusion that the 1963 amendment does not affect the validity or applicability of the 1909 contract. We do not construe the language in the proviso added by the amendment as saying or implying that the P.S.C. shall ignore a con*859tract dated before October 13, 1963. It does not address itself to the question of prior contracts. It deals only with what occurs after its effective date (October 13, 1963) and simply says that if thereafter the railroad and public agency agree on apportionment of costs, the P.S.C. shall abide thereby. It says nothing that would justify a conclusion that the legislature intended by the amendment to nullify an earlier contract, particularly one previously held by this court to be valid and binding on the parties thereto. Furthermore, if the second Oak Street case correctly concluded that constitutional limitations against impairment of the obligation of contracts precluded impairment by the 1913 Public Service Commission Act of Terminal’s obligation as to costs under the 1909 contract, it seems obvious that such limitations likewise would preclude impairment or abrogation thereof by the 1963 legislative amendment. For both of these reasons we hold that the P.S.C. and the circuit court were in error in holding that the 1963 amendment obligated the P.S.C. to ignore the 1909 contract and to apportion the costs on the basis of benefits.
Terminal asserts that even if the 1963 amendment did not have the effect of abrogating the 1909 contract still the court should affirm because the second Oak Street case on which the City relies was wrongly decided and should be overruled. This contention is based on the premise that § 389.640, in authorizing apportionment of costs as well as vesting in the P.S.C. the exclusive right to determine when, where, and how crossings are to be constructed, merely prescribes an appropriate exercise of the police power for the purpose of protecting the public safety.
There can be no doubt that protecting the public at intersections of railroads and streets or roads is a proper exercise of the police power. State ex rel. Missouri, K. & T. Ry. v. Public Service Commission, 271 Mo. 270, 197 S.W. 56 (banc 1917); State ex rel. Alton R.R. v. Public Service Commission, 334 Mo. 995, 70 S.W.2d 61 (1934). Pursuant to that power the legislature had the right to confer on the P.S.C. the exclusive right to determine whether to permit such intersections and, if authorized, to specify where, when and in what manner the intersection should be constructed.
There also is no question but that abrogation of a contract or rights thereunder as a result of proper exercise of the police power does not violate state or federal provisions against impairment of contracts. This is because the police power may not be hindered or frustrated by contracts between individuals or companies or governmental subdivisions. If an existing contract should have the effect of interfering therewith, it must necessarily give way to an appropriate exercise of the police power. State ex rel. Kansas City Terminal Ry. v. Public Service Commission, 308 Mo. 359, 272 S.W. 957 (1925); State ex rel. Wabash Ry. v. Public Service Commission, 306 Mo. 149, 267 S.W. 102 (1924), reversed on other grounds, 273 U.S. 126, 47 S.Ct. 311, 71 L.Ed. 575, but reinstated, 295 S.W. 86 (1927); American Tobacco Co. v. Missouri Pac. Ry., 247 Mo. 374, 157 S.W. 502 (banc 1912). This fact was recognized in the first Oak Street case when the court said, 272 S.W. at 962:
“ * * * A railroad and a municipality cannot, by agreement, determine the manner, including the particular point, of the crossing of the railroad by a street, because of the paramount interest of the public in the question of safety involved.”
City does not contend otherwise on this appeal.
Hence, the real issue in this appeal is whether, as Terminal contends, apportionment of the cost of the crossing by the P.S.C. was so inseparably a part of the Commission’s action under the police power that its exercise necessarily had the effect of abrogating the existing 1909 contract *860between the parties wherein they had agreed that Terminal would pay the cost of such projects. In discussing this question, Terminal’s brief assumes the inevitability of an affirmative answer to this question. It does not in any manner demonstrate that if the P.S.C. does not allocate costs of the viaducts, the protection of the public safety by means of the police power will be frustrated or even hindered. Cases on which Terminal relies also make such an assumption. For example, Terminal cites two Illinois cases in support of its contention that the second Oak Street case was wrongly decided. The first is City of Chicago v. Illinois Commerce Commission, 356 Ill. 501, 190 N.E. 896 (1934). Examination of that opinion discloses that appellant city argued therein that provisions in the contract between it and the railroad requiring the latter to defray the cost of the improvement did not involve the public safety but pertained only to private financial arrangements between the parties. For that reason, the city contended, said financial arrangements did not come within the scope of the subsequent exercise of the state’s police power and were not affected thereby. What did the court’s opinion say in response thereto? Simply that “contracts of the character of the ordinance under review are subject to modification by subsequent statutes enacted in the bona fide exercise of the police power to promote the public health, morals, or safety, or the general welfare, and do not, by reason of the contract clause of the Federal or State Constitution (Const. U.S. art. 1, § 10, subd. 1; Const. Ill. art. 2, § 14), enjoy any immunity from such legislation.” 190 N.E. at 900. The opinion simply stated the unsupported conclusion that apportionment of the costs was part of the police power and its exercise superceded the contract allocating those expenses.
Subsequently, the question arose again in City of Chicago v. Chicago & Nw. Ry., 4 Ill.2d 307, 122 N.E.2d 553 (1954), which is the second of the Illinois cases on which Terminal relies. The city in that case argued that the provision in the contract between it and the railroad whereby the latter would pay the entire cost of reconstruction did not in any way limit the police powers of the Commerce Commission and was simply a voluntary contractual provision entered into for a valid consideration. It argued that the primary concern of the Commerce Commission was to determine whether the reconstruction was sufficient to preserve and promote public safety and to require the work to be done, not with who paid therefor. The court in its opinion concluded that it would not depart from the principles announced in the earlier case of City of Chicago v. Illinois Commerce Commission, supra, stating, 122 N.E.2d at 558:
“ * * * We conclude, therefore, as we did there, that the apportionment of the cost of reconstruction of the viaduct over the grade crossing in question is an inseparable element of the police power which is vested exclusively in the Commerce Commission, and that it may not be abrogated by the contract the city seeks to enforce.”
Obviously, what the court said in the two Illinois cases provided no analysis of whether achievement of the objective of the exercise of the police power was affected in any way by permitting the cost to be allocated between the parties pursuant to their preexisting contract rather than on a basis ordered by the Commission. It did not consider whether the health or safety of the public would be protected just as much if the costs were paid according to the contract as according to the Commission’s directive.
We find that other cases cited by Terminal do not demonstrate that allocation of the cost of improvements directed is so inseparably a part of the police power as to require impairment of contractual obligations. Furthermore, they do not deal with comparable situations. For example, see State ex rel. Chicago, B. & Q. R.R. v. Public *861Service Commission, 334 S.W.2d 54 (Mo.1960); Wabash R.R. v. City of Wellston, 276 S.W.2d 208 (Mo.1955); State ex rel. St. Paul & K. C. Short Line R.R. v. Public Service Commission, 338 Mo. 724, 92 S.W.2d 126 (1936); State ex rel. Alton R.R. v. Public Service Commission, 334 Mo. 995, 70 S.W.2d 57 (1934); State ex rel. City of Kirkwood v. Public Service Commission, 330 Mo. 507, 50 S.W.2d 114 (1932). Other cases cited deal with situations wherein the court held that fixing- rates charg-ed and specifying services to be rendered by public utility companies is an exercise of the police power and that contracts which undertake to fix or limit such rates or services impinge on the police power and are invalid. Typical of this group of cases are State ex rel. Kansas City Public Service Co. v. Latshaw, 325 Mo. 909, 30 S.W.2d 105 (banc 1930); City of Cape Girardeau v. St. Louis-San Francisco Ry., 305 Mo. 590, 267 S.W. 601 (banc 1924); and State ex rel. City of Sedalia v. Public Service Commission, 275 Mo. 201, 204 S.W. 497 (1918). This group of cases cited by respondents is not pertinent because they deal with situations wherein the contract prohibits the very thing which the police power seeks to achieve, not, as here, with the incidental question of who pays for what is being done to protect the public health or safety. We conclude that none of the cases cited by Terminal establish that the second Oak Street case was wrongly decided or that it should be overruled.
We have decided that when a state or city properly directs that something be done in order to protect the public health or safety, it does not necessarily or universally follow that allocation of the costs thereof is such an inseparable part of that exercise of the police power that it automatically overrides and abrogates agreements of the parties as to how such expenses are to be borne. A hypothetical example will demonstrate why this is true. Suppose a city passes an ordinance which recites that the existence of old-time outhouses poses a threat to the health of the community and that they must be eliminated. The ordinance provides that by a specified date all outhouses must be removed and that they shall be replaced by inside toilets which owners of property are obligated to install and pay for. Clearly, under decided cases, this would be a valid exercise of the city’s police power. City of St. Louis v. Hoevel Real Estate & Building Co., 59 S.W.2d 617 (Mo.1933); City of St. Louis v. Nash, 260 S.W. 985 (Mo.1924). However, suppose that shortly prior to passage of that ordinance a landowner and his tenant entered into a contract whereby the owner agreed to do various things desired by the tenant including addition of another bedroom, installation of an inside toilet and paving of a driveway. The parties entered into an agreement which established a new lease period and specified the amount of rent to be paid. As a part of that agreement, the tenant agreed to pay the cost of installing the inside toilet. Under such circumstances, would the passage of the ordinance imposing a duty on the owner to install and pay for the inside toilet abrogate the prior contractual arrangement between the owner and the tenant whereby the tenant had agreed to assume that cost? Clearly not. The objective of this exercise of the police power is to protect the public health and safety. This would be achieved by installation of the inside toilet and the removal of the old outhouse, thereby eliminating discharge of waste materials which might affect water supplies or spread disease. It would be completely immaterial to attainment of that objective whether the cost of the new inside toilet ultimately is borne by the owner or by the tenant. The question of who pays does not affect one iota the protection of the health of the public achieved by reason of the elimination of the old outhouses and construction of the new toilet. That being true, apportionment or assignment by the city of the cost of the improvement would not be such an inseparable part of the police power as to require *862abrogation of the existing contract between the owner and his tenant. Recognizing and enforcing the contract allocating costs would not hinder or frustrate the city’s police power.
There is an analogy between that hypothetical example and the facts of the case at bar. It is clear that the objective sought by the P.S.C. was to protect the safety of the traveling public by making the viaducts sufficiently strong and safe, not to specify who should pay therefor.5 The degree of that safety is not affected by the allocation of the costs between the parties. The public will be just as safe if Terminal pays the costs of the improvements and repairs pursuant to its contractual obligations under the 1909 contract as it will be if 100 per cent of the cost of construction and 90 per cent of the cost of repairs is borne by the City as directed by the order of the Commission.
It is the function of the courts to determine whether a statute purporting to constitute an exercise of the police power has a real and substantial relationship to the protection of the public health, safety, morals or welfare and whether it unjustifiably invades rights secured by the Constitution. This long recognized principle is well stated in Mugler v. Kansas, 123 U.S. 623, 661, 8 S.Ct. 273, 297, 31 L.Ed. 205 (1887). In that case the court, in discussing the police power, its exercise and its extent, stated:
“ * * * Under our system that power is lodged with the legislative branch of the government. It belongs to that department to exert what are known as the police powers of the state, and to determine, primarily, what measures are appropriate or needful for the protection of the public morals, the public health, or the public safety.
“It does not at all follow that every statute enacted ostensibly for the promotion of these ends, is to be accepted as a legitimate exertion of the police powers of the State. There are, of necessity, limits beyond which legislation cannot rightfully go. While every possible presumption is to be indulged in favor of the validity of a statute, Sinking Fund Cases, 99 U.S. 700, 718 [25 L.Ed. 496], the courts must obey the Constitution rather than the law-making department of government, and must, upon their own responsibility, determine whether, in any particular case, these limits have been passed. ‘To what purpose,’ it was said in Marbury v. Madison, 1 Cranch, 137, 176 [5 U.S. 137, 2 L.Ed. 60], ‘are powers limited, and to what purpose is that limitation committed to writing, if these limits may, at any time, be passed by those intended to be restrained? The distinction between a government with limited and unlimited powers is abolished, if those limits do not confine the persons on whom they are imposed, and if acts prohibited and acts allowed are of equal obligation.’ The courts are not bound by mere forms, nor *863are they to be misled by mere pretences. They are at liberty — indeed, are under a solemn duty — to look at the substance of things, whenever they enter upon the inquiry whether the legislature has transcended the limits of its authority. If, therefore, a statute purporting to have been enacted to protect the public health, the public morals, or the public safety, has no real or substantial relation to those objects, or is a palpable invasion of rights secured by the fundamental law, it is the duty of the courts to so adjudge, and thereby give effect to the Constitution.”
The above rule is followed in Missouri. In State v. Layton, 160 Mo. 474, 61 S.W. 171, 174 (1901), the court quoted with approval from Mugler v. Kansas including much of the above quotation. See also 16 Am.Jur.2d Constituutional Law §§ 281, 282, 283; 16 C.J.S. Constitutional Law § 198.
The conclusion we reach is in harmony with our decision in State ex rel. Joplin & Pittsburg Ry. v. Public Service Commission, 289 Mo. 452, 233 S.W. 388 (banc 1921). In that case, the railroad company had a 1910 mortgage contract right to issue bonds on subsequent property additions. Sec. 57 of the P.S.C. Act prohibited issuance of bonds for additions made more than five years prior to application to the Commission for leave to issue bonds, and when the railroad sought authority from the Commission to issue bonds, it declined to approve on the basis that it was prohibited by § 57 of the Act from authorizing issuance. This court, in a proceeding in mandamus, directed the Commission to grant authority to issue the bonds, holding that although the state under its police power had authority to regulate and prohibit issuance of bonds upon property of utility companies, it did not possess such right to the extent of impairing existing contract rights when it did not appear that the public good would be served by withholding from the company the authority to issue bonds in accordance with its contractual rights.
By analogy the state, in this case, acting through the Commission, had the right to direct repairs to and reconstruction of viaducts for the protection of the safety of the public but it did not have authority to abrogate the contract between City and Terminal with reference to allocation of the costs thereof when it was not shown that the public good would be served by taking away the City’s contractual right to have Terminal pay those costs or that enforcing those rights would frustrate or hinder the exercise of the state’s police power.
This view is supported also by Missouri, K. & T. Ry. v. Oklahoma, 271 U.S. 303, 46 S.Ct. 517, 70 L.Ed. 957 (1926), which was discussed and relied upon in the second Oak Street case.6 In M. K. & T., the city entered into a contract with the railroad whereby the latter granted the city a right-of-way for a street under its tracks and the city agreed to construct and pay for the street. Thereafter, the city obtained an order from the state corporation commission directing the railroad to construct an underpass and pay half the cost thereof. The Supreme Court held that the contract between the city and the railroad did not constitute a restraint on the police power, that it was a valid contract supported by adequate consideration and that it was within the protection of the constitutional provision forbidding impairment of the obligation of contracts by the state. Terminal *864seeks to distinguish M. K. & T. from the case at bar but they are analogous.7
We hold that when the state appropriately directs that work be done in order to protect the public health or safety, the police power of the state includes the right to direct payment for the work ordered to the extent necessary to the achievement of the objectives for which the police power is being exercised, even if the result is to infringe on existing contractual rights, but that beyond that necessity, allocation of such costs is not an inseparable part of the police power. A determination that denial of the right of the state or city or its agency to allocate costs will frustrate or hinder enforcement of the police power and achievement of its objective is necessary as a condition to abrogating existing contractual rights.
In the instant case, in the absence of an agreement between the parties with respect to allocation of the costs, it would have been proper under § 389.640 for the Commission not only to specify the work to be done but also how the cost thereof should be borne. However, since the parties previously had entered into a valid and binding contract whereby they spelled out how the costs of such improvements should be borne and since there has been no showing that enforcing those rights will frustrate or hinder the state’s police power or the achievement of its objective, the state’s police power should not be held to abrogate Terminal’s obligation to pay for the improvements involved herein under said prior contractual arrangement.8
The rule we adopt recognizes that the police power is essential to the achievement of such objectives as protecting the health and safety of the public and that it is as broad as need be to achieve those objectives. At the same time, it recognizes that the police power is not so powerful that it impairs the obligations of contracts where such impairment is not necessary to achievement of the objective for which the power is being exercised. Such interpretation is in harmony with the definition of the state’s police power adopted by this court in Marshall v. Kansas City, 355 S.W.2d 877, 883 (Mo. banc 1962):
“State ex rel. Carpenter v. City of St. Louis, 318 Mo. 870, 2 S.W.2d 713, 722[13], has adopted this definition of police power as it now appears in 16 C.J.S. Constitutional Law § 174, p. 889: ‘Police power is the exercise of the sovereign right of a *865government to promote order, safety, health, morals, and the general welfare of society, within constitutional limits.’ The police power is an essential attribute of government without which constitutional guaranties of personal and property rights would be ineffective and meaningless. In their very nature, neither the police power nor constitutional limitations can be absolute; they are necessarily relative and dependent in the complexities of modern life. 5 McQuillin, Municipal Corporations, 3d Ed., § 19.22, p. 531; Ex parte Smith, 231 Mo. 111, 132 S.W. 607, 609[3].”
Accordingly, we reverse the judgment of the circuit court and remand with directions that the case be remanded to the Public Service Commission for an order consistent with the views herein expressed. In so directing we are not, as suggested by Terminal, ordering that the Commission interpret and enforce the 1909 contract. That has been done by this court in the second Oak Street ease and that decision is reaffirmed herein. We merely direct that the Commission recognize and abide by that judicial determination of how the costs of repairs and reconstruction are to be borne under the 1909 contract.
DONNELLY, C. J., and MORGAN, HOLMAN and HENLEY, JJ., concur. BARDGETT, J., dissents in separate dissenting opinion filed. SEILER, J., dissents in separate dissenting opinion filed and concurs in separate dissenting opinion of BARDGETT, J.. Additional details of the franchise arrangement are set out in the opinion of the court in Kansas City v. Kansas City Terminal Ry., 324 Mo. 882, 25 S.W.2d 1055 (banc 1929).
. Apparently, Terminal in the intervening years had acquiesced in the 1909 contract as construed in the second Oak Street case. City’s brief so states and Terminal has not contended otherwise. As a matter of fact, Terminal during this period successfully sought recovery from Kansas City Transit of part of its cost of maintenance of some of the viaducts. Kansas City Terminal Ry. v. Kansas City Transit, Inc., 359 S.W.2d 698 (Mo. banc 1962).
. Sec. 389.640 RSMo 1969 (originally § 50 of the Public Service Commission Act, Laws of Mo., 1913, p. 589), referred to in the P.S.C. order, provides that crossings of railroads, roads, streets and street railroads shall not be constructed without permission of the P.S.C. which shall have exclusive power to determine and prescribe “the manner, including the particular point of crossing, and the terms of installation, operation, maintenance, apportionment of expenses, use and protection” of such crossings, whether at grade or otherwise.
. In 1963, § 389.640(2) was amended (Laws of Mo., 1963, p. 501) and the following proviso was added:
“ * * * provided, however, that any agreement entered into after October 13, 1963, between any such corporation and the state, county, municipality or other public authority in interest, as to the apportionment of any cost mentioned in this section, shall be final and binding upon the filing with the commission of an executed copy of such agreement. If such parties are unable to agree upon the apportionment of said cost, the commission shall, except as to projects of the state highway commission, apportion the cost among the parties according to the benefits accruing to each. In determining such benefits, the commission shall consider all relevant factors including volume, speed and type of vehicular traffic; volume, speed and type of train traffic; savings, if any, which will inure to either party as the result of the project; and advantages to the public and to such corporation resulting from the elimination of delays and the reduction of hazard at the crossing. Any portion of the cost of any such project in excess of such benefits shall be apportioned to and assessed against the corporation, county, municipality, or other public authority desiring to make, or proposing, such installation, alteration, abolishment, or separation.”
. The dissenting opinion of Judge Seiler contends that the interest of the public in this case was not limited to the safety of the viaducts. Rather, he says, it was interested also in the financial condition and stability of Terminal and its ability to maintain service and that requiring Terminal to comply with its contract might cause its equipment to become unsafe and its service to deteriorate. In making this assertion and in seeking to justify allocation of costs herein on that basis, the dissent takes a position not supported by the record on appeal or contended for by Terminal or by the Commission. No contention whatsoever was made in this case by either party that allocation of costs by the Commission was for the purpose of protecting the financial stability of the railroad or the rates it would charge or the services it would render. In fact, during oral argument counsel arguing for respondents expressly stated in response to a question from the bench that the Commission’s allocation of costs was based solely on evidence as to vehicular traffic count over the viaduct and trains passing on the tracks below and had no relationship to the economic situation of the railroad.
. In urging that these two cases should not be followed, the dissent of Judge Bardgett relies heavily on the cases of Northern Pacific R.R. v. Minnesota ex rel. Duluth, 208 U.S. 583, 28 S.Ct. 341, 52 L.Ed. 630 (1908), and State ex rel. Wabash Ry. v. Public Service Comm’n, 306 Mo. 149, 267 S.W. 102 (Mo.1924). However, it should be noted that M. K. & T. is a later decision by the U.S. Supreme Court than Northern Pacific and second Oak Street is a later decision by this court than the Wabash case.
. In M. K. & T. the city received a right-of-way from the railroad for which it undertook certain obligations including an agreement to construct and pay for the street. In this case Terminal received rights-of-way and a 200 year franchise from the city for which it assumed obligations, including the agreement to pay for constructing and repairing viaducts. In both cases the agreement between the railroad and the city was supported by substantial consideration. In both cases there was no showing that the agreement allocating costs constituted a restraint on the exercise of the police power or frustrated in any way the achievement of the objective.
The fact that the contract has a considerable number of years to run is not decisive. During that time Terminal continues to enjoy the franchise and right-of-way which it received in return for its agreement to pay the costs of viaducts. Under the rule announced herein, if a case arises in the future wherein an issue is raised as to whether the contract allocating costs of repairs or reconstruction does frustrate or hinder the state’s exercise of its police power, the court can resolve that issue on the basis of the evidence presented in that case.
. Actually, the amendment to § 389.640(2) adopted in 1963 confirms this conclusion in that it impliedly recognizes that allocation of the costs of the intersection improvements by the P.S.C. is not a necessary and inseparable part of the act of directing what work is to be done. It provides that if, in an agreement dated after October 13, 1963, the railroad and city (or other governmental unit) agree upon allocation of the cost, the P.S.C. is bound thereby and may not apportion the costs otherwise. Only in the absence of such agreement is the Commission to allocate the costs. If it were an inseparable part of the police power, this arrangement would be inappropriate.