
509 P.2d 901 (1972)
MOTOR LODGES, INC., a corporation, et al., Appellants,
v.
Alton WILLINGHAM, Appellee.
No. 44299.
Supreme Court of Oklahoma.
November 21, 1972.
Rehearing Denied May 22, 1973.
McAfee, Dudley, Taft, Cates & Mark by Peter B. Bradford, Ray G. Moss, Oklahoma City, for appellants.
Sullivan, Frates & Maguire by Kent F. Frates, Wesley Smith, Oklahoma City, for appellee.
*902 HODGES, Justice.
Appellee (adjoining landowner) owned an undivided one-half interest in the Oak Park Motel, 5212 North Lincoln Boulevard, Oklahoma City, Oklahoma, at the time the cause of action was filed. Although the motel constituted a non-conforming commercial use of the property on which it was located, it was zoned "A-1" Single Family Estate Dwelling District. The motel adjoins the property of appellants (builders) which is zoned "E" Local Commercial District.
On October 1, 1969, adjoining landowner discovered that builders were constructing a building within five feet of his property line. The construction was in violation of Oklahoma City, Oklahoma Charter and Code § 13.9.05(2) (1960) now § 25.110(b) (1970) which pertains to "E" Local Commercial District and provides as follows:
"Area Regulations (2) * * * For uses other than dwellings no side yard shall be required except on the side of a lot adjoining a dwelling district, in which case there shall be a sideyard of not less than five (5) feet."
Adjoining landowner brought suit to enjoin the construction based on violations of Oklahoma City, Oklahoma Charter and Code.
A temporary restraining order was issued by the district court. An Agreed Journal Entry of Judgment was approved and entered by the court October 8, 1969. The order required builders to remove the foundation so that no portion of it encroached on adjoining landowners property. The Order further enjoined construction of any permanent building which would encroach within five feet of adjoining landowner's property. Thereafter, builders relocated the foundation of the building.
Builders had a survey of the property made by the Oklahoma County Surveyor. Builders allege that Oklahoma City Building Inspector for Zoning visually inspected the property and building and determined that the building was in compliance with the applicable building code and zoning ordinances.
The building was completed with a mansard roof and a sidewalk which ran the length of the south wall. An eave of the roof which projected from the south wall of the building and most of the sidewalk extended over the five foot side yard. It was undisputed that the south wall of the building itself was further than five feet from the building line.
On complaint and motion by the adjoining landowner, the district court cited builders for indirect contempt of court for violation of the Agreed Journal Entry of Judgment on January 5, 1970.
At the hearing on the citation for contempt, the Assistant Director of Planning in charge of Code Administration at the time the building was constructed, testified that a sidewalk and overhang are not construed as part of the building structure.
Builders were given sixty days to purge themselves of contempt by removing any part or portions of the building, including the offending overhanging roof and walkway, which encroached within five feet of appellee's property.
The Court of Appeals modified the Order of the trial court by deleting all references to concrete slab, sidewalk, or walkway, and affirmed the citation for contempt as modified. Certiorari is granted from the decision of the Court of Appeals.
The only reason the side yard was required in the case at bar was that the commercially zoned property of builders adjoined *903 motel property, a commercial use, which was zoned for a dwelling district. A literal reading of the ordinance in question discloses that no side yard is required between two commercially zoned properties.
The increasing concentration of population in urban communities constitutes the basis for zoning regulations which require side yards in a single family estate dwelling district. The rationale for the ordinance is that side yards prevent overcrowding of land and thereby provide a better home environment, safety from fire and other dangers, adequate light, air, and sunshine, room for lawns and trees, and a place for children to play. Gorieb v. Fox, 274 U.S. 603, 607, 608, 47 S.Ct. 675, 71 L.Ed. 1228, 1230, 1231 (1927), Simon v. Town of Needham, 311 Mass. 560, 42 N.E.2d 516 (1942).
It is stipulated by Oklahoma City, Oklahoma Charter and Code § 25-21(a) (1970) formerly § 13.21.02 (1960) that the interpretation and application of the building ordinances shall be held to be the minimum requirements for the promotion of public safety, health, convenience, comfort, morals, prosperity, and general welfare.
The over-all function of zoning is to promote moral and material welfare by designing a systematic plan for uniform development thereby creating a more stable environment in the community. It is a means of strengthening the character of a use of property in a particular area. Rubi v. 49'er Country Club Estates, Inc., 7 Ariz. App. 408, 440 P.2d 44, 47 (1968). State v. Pulliam, 168 Okl. 632, 37 P.2d 417, 425 (1934).
The power to interfere through zoning regulations with general rights of the landowner is not unlimited. Restriction on the character of use of property cannot be imposed if it does not bear a substantial relation to public health, safety, morals or general welfare, City of Sand Springs v. Colliver, 434 P.2d 186 (Okl. 1967).
A five foot side yard between two commercial uses does not substantially relate to public health, safety, morals, or general welfare. The intent of the zoning ordinance was improperly construed at the time the temporary restraining order was granted. Builder's property never adjoined a "dwelling district" in fact, but rather abutted a commercial non-conforming use in a district zoned "A-1" Single Family Estate Dwelling District. When the reason for the rule ceases to exist, the rule should not be technically enforced by the court.
Adjoining landowner seeks removal of the building to "allow more space between buildings on both sides of the mutual property line." It is apparent from the photographs and surveys introduced into evidence that adjoining landowner did not maintain a fifteen foot side yard as required by Oklahoma City Charter and Code § 13.5.23 and 13.5.24 (1960) now 25-62 (1970) pertaining to "A-1" Single Family Dwelling Estates. He who seeks equity must do equity, and must come into court with clean hands. Iven v. Roder, 431 P.2d 321, 327 (Okl. 1967).
This court held in Insurance Service Co. v. Finegan, 196 Okl. 441, 165 P.2d 620, 621 (1946) that:
"An agreed judgment is in the nature of a contract and is to be construed as other contracts."
Even agreed journal entries should be entered into carefully. Their draftsmanship is a matter of considerable importance. However, it is our opinion that the agreed judgment entered by the trial court was based upon the restrictive ordinance. The sole basis for the original action was that appellants had violated the building restriction. We cannot separate the court's judgment from the city ordinance upon which it is founded.
The extraordinary remedy of permanent injunction compelling the alteration, destruction, or removal of property should be granted with extreme caution. It should not be granted unless serious injury is being inflicted, or in all probability will be inflicted. Peck v. State ex rel. Department of Highways, 350 P.2d 948, 950 (Okl. 1960). There was no evidence of substantial *904 detriment of damage suffered by appellee.
It requires a tortured construction of the ordinance to permit an owner of a non-conforming use to enforce a technicality which he has been permitted to ignore (because his use existed prior to zoning) to the detriment of another.
The judgments of the Court of Appeals and the trial court are reversed. The citation for contempt is dismissed.
DAVISION, V.C.J., and WILLIAMS, JACKSON, IRWIN, LAVENDER, BARNES and SIMMS, JJ., concur.
