The defendant, Jarib M. Sanderson, Jr., appeals from a decision of the Superior Court {Dunn, J.) ordering him to cease and desist in the removal of gravel from a parcel of land in North Hampton. He claims that the trial court erred by: (1) ruling that a settlement agreement he entered into with the Town of North Hampton (“town”) was not valid and binding; (2) finding that he violated the terms of the agreement; (3) failing to grant his request that a permit for gravel removal was not required because of the actions of the North Hampton Planning Board; (4) finding that neither the permit requirements of the town zoning ordinance, section 511, nor the provisions of RSA chapter 155-E apply to his activities; and (5) ruling that both the plaintiff and the intervenors were entitled to costs and attorney’s fees under RSA 155-E:10. For the reasons that follow, we affirm.
On June 27, 1979, the defendant purchased approximately fourteen acres of land in an approved residential subdivision on Lovering Road in North Hampton. The land consisted of five lots, numbers nine through thirteen, which were mostly situated above the existing grade of Lovering Road.
Prior to purchasing the land, on May 1, 1979, the defendant appeared before a meeting of the planning board to inquire about removing gravel from the land. Since 1968, the town has had a zoning ordinance requiring individuals to apply for and obtain *616permits from the planning board to operate gravel pits. North Hampton Zoning Ordinance, section 511. According to the minutes of the meeting, the defendant informed the planning board that he intended to purchase the land and that he planned to “lower the level of land by removing gravel form [sic] some areas.” Harry Brinser, the chairman of the meeting, informed the defendant that “he was within his rights to do so as long as he retained the loam and caused no drainage problems.” The defendant never applied to the planning board for a permit to remove the gravel. After the purchase of the lots, the defendant commenced the removal of gravel, beginning on lot 13 and subsequently expanding his operations to include lots 9 through 12.
On August 28, 1979, the town, through its zoning enforcement officer, ordered the defendant to cease and desist in the removal of gravel. The defendant responded in a letter stating that the planning board had given him “official permission to remove gravel,” he was not operating a gravel pit, and that he was “not in violation of Section 511 or any other town ordinances.” Rather, he claimed to be “merely doing site work and preparing [his] lots for single family residences in accordance with the Planning Board directives.” In September, 1979, the town filed a complaint in North Hampton District Court charging the defendant with violation of section 511 of the town zoning ordinance and violation of the cease and desist order. Subsequently, on September 24, 1979, the defendant and the board of selectmen, acting on behalf of the town, entered into a settlement agreement by which the town released its claims against the defendant in exchange for his promise to repair damage and restore certain road conditions. The planning board was not a party to the agreement.
Over the next several years, both the planning board and the board of selectmen contacted the defendant concerning the removal of gravel. In March, 1981, the planning board advised the defendant to apply for a permit in order to comply with section 511 of the zoning ordinance. In July, 1985, the board of selectmen, in a letter to the defendant, requested that he correct a dust problem which purportedly violated the terms of the settlement agreement. The selectmen again, in October 1985, contacted the defendant concerning compliance with RSA chapter 155.
The intervenors, John R. and Bernice D. Newton, own and reside upon land abutting the defendant’s property. In September, 1986, they filed a bill in equity requesting that the town enforce compliance with the permit requirements of the zoning ordinance and RSA chapter 155-E. The town then filed suit against the *617defendant in September, 1987, seeking the temporary and permanent injunction from further gravel removal operations, fines, costs, and attorney’s fees under RSA 155-E:10, II (Supp. 1988), and restoration pursuant to RSA 155-E:5 (Supp. 1988) and the town zoning ordinance. The two actions were consolidated and the Newtons were allowed to intervene in the town’s action. The superior court, approving the recommendation of the Master ('Charles T. Gallagher, Esq.), ordered the defendant to cease and desist from further excavation until he applied for and received all permits required by State and local authorities. The court also awarded attorney’s fees to both the town and the intervenors, pursuant to RSA 155-E-.10, II (Supp. 1988). This appeal followed.
The defendant contends that the settlement agreement, signed by the board of selectmen, is valid and binding and constitutes, in effect, a “permit” for the removal of gravel. He argues that the agreement is consistent with the intent of the zoning ordinance and is governed by the principles of J.E.D. Associates, Inc. v. Town of Danville, 122 N.H. 234, 444 A.2d 493 (1982). That case involved a settlement agreement entered into by town counsel who was representing the planning board, the town, and the board of selectmen in a dispute concerning the application of subdivision regulations. Noting that subdivision regulations were within the exclusive jurisdiction of the planning board, this court held that the agreement was binding because the town’s counsel was representing the planning board, which was a party to the action, in addition to representing the other defendants. Id. at 236, 444 A.2d at 494. The defendant argues that J.E.D. Associates, Inc. governs this case because the planning board informed the defendant at its May 1, 1979 meeting that he did not need a permit.
We disagree with the defendant’s contentions. The fact that one planning board member told the defendant he need not obtain a permit does not bring this case within the scope of J.E.D. Associates, Inc. The defendant himself correctly points out that under sections 511.1 and 511.2 of the town zoning ordinance, the power to regulate gravel pits lies with the planning board. Unlike the planning board in J.E.D. Associates, Inc., which was a party in the lawsuit, here the North Hampton planning board was a party to neither the action brought against the defendant in 1979, nor the settlement agreement. Furthermore, we fail to see how the statement of one planning board member at the May, 1979 meeting can be construed as an approval or ratification of the settlement agreement entered into four months later.
*618In Buxton v. Town of Exeter, 117 N.H. 27, 369 A.2d 188 (1977), this court held that the Exeter board of selectmen did not have the authority to enter into a settlement agreement which would grant a special exception for the operation of a gravel quarry, because the zoning ordinance vested that power exclusively in the board of adjustment. The agreement was therefore without effect. Id. at 29, 369 A.2d at 189. The law of Buxton applies to this case. Because sections 511.1 and 511.2 give the planning board, and not the selectmen, the authority to issue permits for the operation of gravel pits, we hold that the settlement agreement was invalid and could not bind the parties. As we stated in Buxton, “[T]he selectmen may not do indirectly that which they cannot do directly.” Buxton, supra at 29, 369 A.2d at 189. It is therefore unnecessary for us to consider the issue of whether the defendant’s actions constituted a breach of the agreement.
The defendant next argues that the master erred by failing to grant his request that a permit was not required because the chairman of the planning board informed him he could remove gravel “as long as he retained the loam, and caused no drainage problems,” and that under section 511.1, the planning board may allow excavation without the necessity of applying for and obtaining a permit. We reject this argument.
Section 511.1 provides:
“No further permits shall be issued for a Quarry, Gravel Pit, Sand Pit or for any similar use, or for the removal of loam except upon application to and at the option of the Planning Board. Permits may be issued if in their opinion it is not injurious or detrimental to the neighborhood.”
The defendant construes the language “at the option of the Planning Board” to mean that they could opt not to require a permit altogether but allow excavation. Reading the language of the ordinance according to its plain and ordinary meaning, it is obvious that the board has only two options; it can either decide to issue a permit or deny the applicant’s request and refuse permission to excavate. Furthermore, sections 511.3 through 511.5 provide a detailed procedure which an applicant must follow to apply for a permit. The defendant did not apply for a permit as section 511 requires, and we will not interpret the ordinance or the planning board’s actions as excusing this requirement.
We note, moreover, that the defendant’s position before the planning board and at trial was that he was not operating a gravel pit but merely was leveling off the land and lowering the grade to street level to prepare it for residential building lots. On such *619a set of facts, the planning board member might have been correct in his advice that no permit was required. The master found, however, that the defendant was operating an unpermitted, commercial gravel pit operation. The evidence overwhelmingly-supported this finding. In fact, at oral argument, upon questioning by the court and in the face of the master’s specific finding, defendant’s counsel appears to have abandoned the argument that the defendant’s operation was not a “gravel pit” under section 511 and to have conceded that he was, in fact, excavating a gravel pit within the meaning of RSA chapter 155-E. In essence, counsel now asks us to find that the planning board had the omniscience to realize that the defendant was actually operating a gravel pit, and then to grant him an exception to the permit requirements of section 511. We refuse to do so.
The defendant further maintains that sections 511.1 and 511.2 do not apply to his gravel removal operations on the ground that these provisions either are too vague or do not apply specifically to him. In addition to section 511.1, quoted above, section 511.2 provides the following:
“All Quarries, Gravel Pits, or Loam Fields now open must have a permit to be issued by the Planning Board for an initial period of not more than one year and to be subject to renewal upon application to and at the option of the Planning Board for successive periods of not more than one year.”
The defendant argues that the language “no further permits” in section 511.1 is vague because it appears to apply to gravel pit operations already having had permits, and that the language, “[a]ll . . . [gjravel [p]its . . . now open,” section 511.2, is vague or does not apply to his activities because this language refers only to removal operations existing at the time the ordinance was adopted, well before he began his excavation.
The burden of proving the invalidity of an ordinance lies with the party attacking its validity. Alexander v. Town of Hampstead, 129 N.H. 278, 281, 525 A.2d 276, 278 (1987); Town of Nottingham v. Harvey, 120 N.H. 889, 892, 424 A.2d 1125, 1127 (1980). “When a municipal ordinance is challenged, there is a presumption that the ordinance is valid and, consequently, not lightly to be overturned.” Town of Nottingham, supra at 892, 424 A.2d at 1127. The standard for determining vagueness is that “'[generally, a municipal ordinance must be framed in terms sufficiently clear, definite, and certain, so that an average [person] *620after reading it will understand when [one] is violating its provisions.’” Alexander, supra at 281, 525 A.2d at 278 (quoting Town of Freedom v. Gillespie, 120 N.H. 576, 580, 419 A.2d 1090, 1092 (1980)).
In this case it is apparent that, although the language could be more clearly worded, the ordinance is sufficiently clear to warn the average person that he is violating its provisions. At trial, the defendant in fact testified that if he had been operating a gravel pit, the ordinance would have required him to obtain a permit. Because he himself understood the ordinance to require a permit, he has failed to meet the burden of proving that the ordinance was impermissibly vague. See Alexander, supra at 281, 525 A.2d at 278.
The next issue raised by the defendant is whether RSA chapter 155-E, which requires an owner to obtain a permit before any excavation of earth, applies to his activities. See RSA 155-E :2. He contends that under Laws 1979, 481:3, the grandfather clause of RSA chapter 155-E, his entire gravel removal operation was exempted from the permit requirement.
Laws 1979, 481:3 provides:
“Any owner of an existing excavation in use as of the effective date of this act [Aug. 24, 1979] and which is subject to this act may continue such existing excavation without a permit but shall perform restoration in compliance with RSA 155-E:5 within a reasonable period following the intended cessation of the excavation or any completed section thereof.” ■
The intervenors argue that the defendant cannot avail himself of the protection of the grandfather clause because “an existing excavation in use” must be legal under local law, and the defendant’s excavation was in violation of section 511 as of August 24, 1979, the effective date of the grandfather clause. We agree. Although RSA chapter 155-E is not a zoning ordinance, our analysis in nonconforming use cases is instructive here. The law is well established that a nonconforming use is permissible only where it legally exists at the date of the adoption of the zoning ordinance. Town of Derry v. Simonsen, 117 N.H. 1010, 1016, 380 A.2d 1101, 1105 (1977); Arsenault v. Keene, 104 N.H. 356, 358, 187 A.2d 60, 62 (1962). This rule of law is based on the principle that ‘“[provisions which except existing uses are intended to favor uses which were both existing and lawful, not to aid users who have succeeded in evading previous restrictions.’” Town of Derry, supra *621at 1016, 380 A.2d at 1105 (quoting Arsenault, supra at 359-60, 187 A.2d at 62-63).
The same reasoning applies to RSA 155-E:2 (Supp. 1988) and its grandfather clause. The defendant should not be able to shield an activity which was illegal under the town zoning ordinance at the time the grandfather clause went into effect. We therefore hold that the defendant’s gravel removal operations were not exempt from and were in violation of the permit requirements of RSA chapter 155-E. Because the grandfather provision is of no avail to the defendant, we need not discuss his argument concerning the area of land to which the provision would apply. See generally Town of Wolfeboro v. Smith., 131 N.H. 449, 556 A.2d 755 (1989).
The defendant also argues that the trial court erred in denying his request that he was not subject to RSA chapter 155-E because his excavation was “incidental to the lawful construction ... of a building or structure” under RSA 155-E:2, I (Supp. 1988). We find no error. After more than eight years of commercial gravel removal, the evidence supports the conclusion that the defendant’s excavation was not “incidental” to the construction of residential homes.
Lastly, we turn to the issue of whether the superior court’s awards to both the intervenors and the town of all costs and attorney’s fees were proper. RSA 155-E:10, II (Supp. 1988) provides the following:
“The regulator or a person affected thereby may seek an order from the superior court that the violator cease and desist from violation of any provision of his permit or this chapter and take such action as may be necessary to be in compliance with his permit and this chapter. If the superior court issues such an order the regulator or the person affected, as the case may be, shall have judgment for all costs and attorney fees in seeking such an order.”
The defendant challenges the award on the basis that the language, “the regulator or a person affected,” precludes an award to both the town and intervenors, and that because the intervenors elected to bring an action against the town, rather than the defendant directly, they should not be entitled to costs and attorney’s fees for voluntarily electing to intervene in the town’s action.
*622At the outset we note that since the defendant’s failure to obtain a permit constitutes a violation of RSA 155-E:2 (Supp. 1988), attorney’s fees are required under this chapter. We must determine, however, whether the use of the word “or” in RSA 155-E:10, II (Supp. 1988) was intended to prevent both parties from receiving attorney’s fees. The “‘intent of an ordinance or statute is determined from its construction as a whole and not by construing separately isolated words or phrases.’” Carter v. City of Nashua, 116 N.H. 466, 468, 362 A.2d 191, 193 (1976) (quoting Hancock v. Concord, 114 N.H. 404, 406, 322 A.2d 605, 606 (1974)). The first sentence of RSA 155-E:10, II (Supp. 1988) gives “the regulator [the town] or a person affected thereby [the intervenors]” the right to seek a cease and desist order for violations of RSA chapter 155. Although the statute is phrased using the term “or” instead of “and,” it is apparent from the context of the statute that both parties may seek such an order. See In re Russell C, 120 N.H. 260, 264, 414 A.2d 934, 936 (1980) (statutory language not given its ordinary meaning where context of statute indicates different meaning). It would be inconsistent with the general purpose of the statute to find that only one party may enforce the statute. This is especially so since the regulator and the person affected may have differing interests.
Just as both the “regulator” and the “person affected” may seek a cease and desist order, we conclude that the second sentence of RSA 155-E:10 (Supp. 1988), giving the regulator or the person affected the right to all costs and attorney’s fees in seeking the order, allows both parties to collect attorney’s fees. We agree with the town’s position that if the town and the intervenors had brought separate actions against the defendant, the language of RSA 155-E:10 (Supp. 1988) appears to mandate awards to both parties. The joining of the parties in one judicially economical law suit should not alter this result. An award of attorney’s fees to the prevailing parties in this case is consistent with the purposes of the statute, which are to allow regulation of gravel pit operations, RSA 155-E:2 (Supp. 1988) (permit requirement), protect the environment, RSA 155-E:4 (Supp. 1988) (prohibition of certain projects), and restore the affected area, RSA 155-E:5 (Supp. 1988) (restoration section). Moreover, the fact that the intervenors chose first to proceed against the town, and then to intervene in the action against the defendant, is irrelevant, since they sought the same objective, the enforcement of RSA chapter 155.
*623We hold, therefore, that RSA 155-E:2 (Supp. 1988) requires an award of attorney’s fees to both the “regulator” and the “person affected” in this case. We do not decide, however, whether RSA 155-E:2 (Supp. 1988) would, in every case, require a defendant to pay costs and attorney’s fees to multiple plaintiffs regardless of unnecessary duplication of effort and resources.
Affirmed.
All concurred.