
597 N.E.2d 215 (1992)
232 Ill. App.3d 1
173 Ill.Dec. 507
In re MARRIAGE OF Richard YNDESTAD, Petitioner-Appellee, and
Anita Yndestad, n/k/a Anita Packard, Respondent-Appellant.
No. 2-91-0856.
Appellate Court of Illinois, Second District.
July 10, 1992.
Rehearing Denied August 28, 1992.
*216 Kimberly Backman, E. William Bedrava (argued), Bedrava Lyman & Van Epps, Oak Brook, for Anita Yndestad.
Paul A. McLennon, McLennon Law Offices, Gerald M. Sheridan, Jr. (argued) Sheridan & Associates, Wheaton, for Richard Yndestad.
Justice DUNN delivered the opinion of the court:
Respondent, Anita Packard (Anita), appeals from an order of the circuit court of Du Page County dismissing her petition to remove her daughter, Kerry, from the State of Illinois. The trial court construed the petition as a motion to modify a custody judgment and dismissed it because there was no accompanying affidavit showing that Kerry's health could be seriously endangered by her present environment. Such an affidavit is required if a motion to modify a custody judgment is filed within two years of judgment. (Ill.Rev.Stat.1989, ch. 40, par. 610(a).) Anita argues on appeal that the trial court's dismissal order was improper because the above provision does not apply to petitions for removal, which are governed by section 609 of the Illinois Marriage and Dissolution of Marriage Act (Act) (Ill.Rev.Stat.1989, ch. 40, par. 609). Petitioner, Richard Yndestad (Richard), contends that the trial court acted properly in construing the petition as a motion to modify a custody judgment because the judgment of dissolution specifically required Anita and Kerry to reside within 50 miles of Naperville. We reverse and remand.
On February 20, 1990, Richard filed a petition for dissolution of the parties' marriage. Richard and Anita subsequently executed a joint parenting agreement which was incorporated into the judgment of dissolution of marriage entered by the circuit court on June 22, 1990.
The joint parenting agreement provides, in part, as follows. The parties have joint custody of Kerry with Anita as the primary *217 physical custodian. Richard has physical custody of Kerry on alternate weekends, for a 2½-hour period on Tuesday and Thursday nights, and during certain holidays. He is also permitted up to six weeks of visitation per year.
The agreement further provides that Anita will continue to reside within a 50-mile radius of her residence in Naperville, and she acknowledges that the custodial arrangements provided for in the agreement were based to a substantial extent upon the close proximity of the parties' residences. If Richard moved outside the aforementioned 50-mile radius, Anita would no longer be bound by this provision.
Anita filed her petition to remove Kerry from Illinois on December 17, 1990. In the petition, Anita stated that she had recently married a man who resided in Argonne, Wisconsin. Anita wished to move to her new husband's residence along with Kerry. The petition alleged that the move would be in Kerry's best interests. The parties agree that Argonne is outside the 50-mile radius mentioned in the joint parenting agreement.
Richard filed a motion to strike the petition to remove on the basis that it was actually a motion to modify a custody judgment, and there were no attached affidavits showing possible serious endangerment as required by section 610(a) of the Act. The trial court agreed and entered an order dismissing the petition. Anita now appeals.
Richard initially contends that this court lacks jurisdiction to consider this appeal because the trial court's order did not preclude amendment of the petition and was, therefore, not final. We disagree. With certain exceptions that do not apply here, a reviewing court's jurisdiction is limited to appeals from final orders. (Schuster Equipment Co. v. Design Electronic Services, Inc. (1990), 197 Ill.App.3d 566, 568, 144 Ill.Dec. 58, 554 N.E.2d 1097.) An order is final and appealable if it terminates the litigation between the parties on the merits so that the trial court need only execute on the judgment if it is affirmed. Kellerman v. Crowe (1987), 119 Ill.2d Ill, 115, 115 Ill.Dec. 591, 518 N.E.2d 116.
A reviewing court will look to the substance of an order rather than the form to determine whether it is final and appealable. (Schuster Equipment Co., 197 Ill. App.3d at 568, 144 Ill.Dec. 58, 554 N.E.2d 1097.) If a complaint is dismissed because it is legally insufficient to state a cause of action, as opposed to being technically deficient, the dismissal order is final and appealable if leave to amend is not granted. (Schuster Equipment Co., 197 Ill.App.3d at 568, 144 Ill.Dec. 58, 554 N.E.2d 1097.) This is true even if the order does not state that the complaint is dismissed "with prejudice." 197 Ill.App.3d at 568, 144 Ill.Dec. 58, 554 N.E.2d 1097.
Here, Anita's petition to remove Kerry to Wisconsin was not dismissed because of a technical deficiency. The trial judge determined as a matter of law that, under the circumstances of this case, the petition for removal amounted to a petition to modify a custody judgment. The judge dismissed the petition because Anita presented no affidavits showing potential serious endangerment to Kerry's health if the petition was not granted as required by section 610(a) of the Act (Ill.Rev.Stat.1989, ch. 40, par. 610(a)) for motions to modify a custody judgment which are made within two years of the judgment.
The trial judge's ruling amounts to a determination that, under the circumstances of this case, no petition for removal pursuant to section 609 of the Act (Ill.Rev. Stat. 1989, ch. 40, par. 609), standing alone, could be granted. Instead, Anita would have to present a motion to modify the judgment and meet the far more stringent standard of section 610(a), showing serious endangerment to the child as opposed to showing that removal would be in the child's best interest. Applying the Schuster Equipment Co. holding, Anita's "cause of action" in this case was for leave pursuant to section 609 of the Act to remove her child to Wisconsin. The trial judge's dismissal order prevented her from further prosecuting this cause of action and did not grant her leave to amend. We therefore *218 conclude that, in substance, the dismissal order is final and appealable.
We now turn to the merits. Section 609(a) of the Act states, in part, as follows:
"The court may grant leave, before or after judgment, to any party having custody of any minor child or children to remove such child or children from Illinois whenever such approval is in the best interests of such child or children." (Ill.Rev.Stat.1989, ch. 40, par. 609(a).)
Section 610(a) of the Act, which the trial court relied upon in dismissing Anita's petition, states as follows:
"Unless by stipulation of the parties, no motion to modify a custody judgment may be made earlier than 2 years after its date, unless the court permits it to be made on the basis of affidavits that there is reason to believe the child's present environment may seriously endanger his physical, mental, moral, or emotional health." Ill.Rev.Stat.1989, ch. 40, par. 610(a).
Anita contends that the trial court erred in applying section 610(a) because that provision does not apply to petitions to remove, which are governed by section 609. As Anita points out, it has been held that a petition to remove a child to another State is not a motion for modification of a custody judgment even if granting the petition would have an impact upon the nonmovant's joint custody rights. (Winebright v. Winebright (1987), 155 Ill.App.3d 722, 724, 108 Ill.Dec. 463, 508 N.E.2d 774; In re Marriage of Bednar (1986), 146 Ill.App.3d 704, 710-11, 100 Ill.Dec. 84, 496 N.E.2d 1149.) In both of these cases, the courts held that section 609 applied rather than section 610(a) of the Act, even though the removal petitions were filed within two years of the dissolution judgments. Winebright, 155 Ill.App.3d at 724, 108 Ill.Dec. 463, 508 N.E.2d 774; Bednar, 146 Ill. App.3d at 710-11, 100 Ill.Dec. 84, 496 N.E.2d 1149.
Neither Winebright nor Bednar involved dissolution judgments containing provisions restricting the area in which the primary custodial parent may live. Therefore, in those cases, unlike the case at bar, allowing removal would not have directly contravened any provision in the judgment for dissolution. In Falk v. Falk (1979), 77 Ill.App.3d 13, 32 Ill.Dec. 520, 395 N.E.2d 750, also cited by Anita, the judgment of dissolution incorporated a stipulated agreement between the parties which provided that the petitioner would not remove the parties' child from the Quad Cities area without the respondent's permission. About four years after the judgment was entered, the petitioner filed a petition to modify the dissolution decree to allow her to remove the child to Peoria. The trial court denied the petition solely on the basis that the agreement barred the petitioner from moving the child out of the Quad Cities area. Falk, 77 Ill.App.3d at 13-15, 32 Ill.Dec. 520, 395 N.E.2d 750.
The appellate court reversed in Falk, stating that, while agreements between the parties which are incorporated into dissolution decrees are given considerable weight, the trial court is not bound by such an agreement if, by reason of a change in circumstances, it is no longer in the child's best interests. (77 Ill.App.3d at 15, 32 Ill. Dec. 520, 395 N.E.2d 750.) The appellate court stated that, if such an agreement limits the area to which a child may be removed, the best interests standard is applicable if the primary custodian petitions to remove the child from that area. 77 Ill.App.3d at 15-16, 32 Ill.Dec. 520, 395 N.E.2d 750.
Falk is not dispositive of the issue presented here because the petitioner in that case did not seek to remove her child within two years of the entry of the dissolution judgment as in the case at bar. The court's decision in Falk was, in fact, consistent with the applicable standard for modifying custody judgments more than two years after their entry (see Ill.Rev. Stat. 1977, ch. 40, par. 610(b)). Therefore, while certain language from Falk provides support for Anita's position, the case is distinguishable.
Although the authorities cited by Anita indicate that the best interests standard is ordinarily applied in determining whether the primary custodian should be allowed to *219 remove a child from the State, there is no Illinois case involving a situation in which removal is sought within two years of judgment and would be contrary to the terms of that judgment. Section 609 of the Act states that leave to remove a child from Illinois may be granted, before or after judgment, "whenever such approval is in the best interests of such child or children." (Emphasis added.) (Ill.Rev.Stat. 1989, ch. 40, par. 609.) The language of section 609 provides no exceptions to this rule. The language of section 610(a) is equally clear; motions to modify custody judgments may not be presented within two years of judgment without affidavits indicating potential serious endangerment to the child's health from her present environment. (Ill.Rev.Stat.1989, ch. 40, par. 610(a).) Under the circumstances of this case, an apparent conflict exists between these two provisions of the Act.
The primary rule of statutory construction is to determine and give effect to the legislature's intent. (In re Marriage of Grabarek (1988), 175 Ill.App.3d 1045, 1047, 125 Ill.Dec. 522, 530 N.E.2d 680.) In Grabarek, as in the present case, the parties executed a joint parenting agreement which was incorporated into the judgment of dissolution. The agreement provided that there would be binding mediation if the parties had a disagreement concerning any terms of the agreement or about any matter concerning the children. Within two years of the entry of the dissolution judgment, the petitioner filed a petition to modify the judgment by increasing the respondent's child support obligation. The trial court dismissed the petition on the basis that the petitioner had not first sought mediation as required by the joint parenting agreement. Grabarek, 175 Ill. App.3d at 1046-47, 125 Ill.Dec. 522, 530 N.E.2d 680.
On appeal, this court examined the language of section 602.1(b) of the Act (Ill. Rev.Stat.1989, ch. 40, par. 602.1(b)), which concerns joint custody and joint parenting agreements. Section 602.1(b) states, in part, that a joint parenting agreement "shall specify each parent's powers, rights and responsibilities for the personal care of the child and for major decisions such as education, health care, and religious training." (Ill.Rev.Stat.1989, ch. 40, par. 602.1(b).) This court stated as follows in Grabarek with regard to section 602.1:
"This section does not specifically refer to child support, nor do we construe any of its language as including child support as part of any joint custody agreement or order. Nor does section 602.1 suggest that a joint custody agreement or order will supersede or modify any of the child support sections of the Act. Thus, in reading the plain language of section 602.1, we find no provision allowing the parents or the court to include as part of a joint custody agreement or order any provision regarding child support or any modification of any child support award." (Grabarek, 175 Ill.App.3d at 1048, 125 Ill.Dec. 522, 530 N.E.2d 680.)
This court went on to determine that, because the petitioner sought modification of the respondent's child support obligation by means of a petition consistent with the procedures set forth in section 511 of the Act (Ill.Rev.Stat.1989, ch. 40, par. 511), the petition should not have been dismissed notwithstanding the joint parenting agreement. Grabarek, 175 Ill.App.3d at 1049, 125 Ill.Dec. 522, 530 N.E.2d 680.
There is no language in section 602.1 concerning the removal of children from Illinois. Nor is there any language suggesting that a joint parenting agreement or order may supersede or modify the provision of the Act concerning removal. We therefore conclude that petitions to remove a child from Illinois are governed by section 609 of the Act (Ill.Rev.Stat.1989, ch. 40, par. 609), despite any provisions in a joint parenting agreement purporting to limit the right of removal. The impact of the proposed removal upon the joint custody rights of the nonresidential custodial parent is, however, an important factor in determining whether removal is in the child's best interests. (In re Marriage of Bednar (1986), 146 Ill.App.3d 704, 711, 100 Ill.Dec. 84, 496 N.E.2d 1149.) This factor may be considered upon remand, along with the factors discussed by our supreme *220 court in In re Marriage of Eckert (1988), 119 Ill.2d 316, 326-28, 116 Ill.Dec. 220, 518 N.E.2d 1041, in determining whether the proposed move is in Kerry's best interest.
For the above reasons, the order of the circuit court of Du Page County dismissing Anita's petition to remove is reversed, and the cause is remanded for further proceedings.
Reversed and remanded.
INGLIS, P.J., and WOODWARD, J. concur.
