
634 S.E.2d 706 (2006)
Leon BARBER
v.
VISTARMS, INC.
Record No. 052094.
Supreme Court of Virginia.
September 15, 2006.
*708 David A. Temeles, Jr. (Temeles & Temeles, on brief), for appellant.
Philip J. Harvey, Vienna (Linda M. Jackson, Varda Hussain, Venable LLP, on brief), for appellee.
Present: All the Justices.
OPINION BY Justice LAWRENCE L. KOONTZ, JR.
In this appeal, we consider whether the trial court correctly sustained a demurrer to an amended petition for writ of mandamus brought by a former employee of a closely held corporation who sought to compel the corporation to allow access to the corporation's books and records, issue notice of dissenting rights, and refrain from distributing assets of the corporation. The dispositive issue is whether the trial court correctly determined that the former employee's ownership of shares of stock in the corporation had been terminated pursuant to several agreements between the former employee and the corporation and, thus, that the former employee lacked standing to receive the requested relief when he filed his petition for writ of mandamus.

BACKGROUND
The principles of appellate review that guide our consideration of a trial court's judgment granting a demurrer are well-settled. A demurrer admits the truth of the facts alleged in the pleading to which it is addressed, as well as any facts that may be reasonably and fairly implied and inferred from those facts. See Yuzefovsky v. St. *709 John's Wood Apts., 261 Va. 97, 102, 540 S.E.2d 134, 136 (2001). Thus, we will recite the facts as alleged in the former employee's petition for writ of mandamus in the light most favorable to the former employee. Id. at 102, 540 S.E.2d at 137.
Leon Barber commenced employment in 1994 with VistaRMS, Inc., a closely held corporation initially owned by three shareholders. By 1998, the three original shareholders determined to extend ownership of common stock in the corporation to four designated employees of VistaRMS. Accordingly, the three original shareholders and this group of employees, which did not include Barber, entered into an agreement on December 22, 1998 ("1998 Agreement") whereby the employees received a limited number of shares of VistaRMS common stock.
The 1998 Agreement reflected the original shareholders' intent to ensure that VistaRMS would retain its character as a closely held corporation while simultaneously granting ownership interests to the employees. The preamble to the 1998 Agreement stated that allocation of stock was intended to be performed in a manner that "preserve[d] the closely held nature of the common stock of the [c]orporation." Consistent with this objective, the 1998 Agreement provided that "[i]t is specifically understood and agreed to by the parties that should [an employee] leave the employment of VistaRMS for any reason  either voluntarily, by termination of employment or death  [his] ownership of the common stock[ ] shall immediately cease." Additionally, the 1998 Agreement prohibited the employees' transfer of their shares of stock to a third party "without the expressed written joint approval" of the three original shareholders.
In 1999, an addendum ("1999 Addendum") to the 1998 Agreement was executed between VistaRMS and Barber. Pursuant to this Addendum, VistaRMS allocated and delivered to Barber a certificate representing two shares of VistaRMS common stock. In 2002, another addendum ("2002 Addendum") was executed by the parties under which Barber received additional certificated shares of VistaRMS common stock.[1] Other than allocating a different number of shares, the 1999 and 2002 Addenda, and the certificates issued upon execution of the Addenda, were virtually identical.[2] Like the 1998 Agreement, the Addenda expressed an intention to "preserve the closely held nature of the common stock" of VistaRMS and prohibited the transfer of stock by employees "without the expressed written joint approval" of the original shareholders. Regarding the consequences of Barber's departure or termination from employment by VistaRMS, the 1999 and 2002 Addenda stated:
It is specifically understood and agreed to by Barber that should he leave the employment of the Corporation for any reason  either voluntarily, by termination of employment or by death  her [sic] ownership of the common stocks . . . shall immediately cease. In such an event, the shares of common stocks owned by Barber shall be reallocated in accordance with the terms of the December 22, 1998 Agreement.
On January 15, 2004, VistaRMS terminated Barber's employment without explanation and, apparently, to Barber's surprise. On the same day, VistaRMS presented Barber with a Separation Agreement providing, in relevant part, that:
3. Except as required by law or as otherwise provided in this paragraph, [Barber's] *710 right to all employee benefits from or through VistaRMS, including (without limitation) compensation, future compensation, bonuses, savings plans, stocks and stock options . . . are terminated as of January 15, 2004.
. . . .
5. The Parties agree that this agreement settles all existing claims to which [Barber] may be entitled. [Barber] acknowledges and agrees that he will not be entitled to receive any future compensation from VistaRMS, in any manner, including but not limited to bonuses, stock options or any other form of financial compensation.
. . . .
6.(a) [Barber] does forever waive, release and discharge VistaRMS . . . from any and all claims . . . of any kind whatsoever . . . arising out of [his] entire employment relationship with VistaRMS and the termination thereof . . . .
6. (b) All the persons and entities affiliated or associated with VistaRMS . . . hereby release [Barber] from any and all legal claims and causes of action . . . arising out of [Barber's] entire employment relationship with VistaRMS, and the termination thereof.
Barber signed the Separation Agreement.[3]
Barber retained possession of the stock certificates representing the shares issued to him by VistaRMS pursuant to the 1999 and 2002 addenda. Moreover, VistaRMS did not register in its corporate records that these shares had been reallocated or otherwise transferred following the termination of Barber's employment.
In December 2004, Barber learned that discussions were taking place concerning the possible sale of VistaRMS to another corporation.[4] Barber presented VistaRMS with written requests for access to corporate records in order to "evaluate the transaction and determine monies that are due to me." VistaRMS refused, asserting that Barber's ownership of VistaRMS stock ceased upon the termination of his employment pursuant to the 1998 Agreement and the 1999 and 2002 Addenda.
On February 15, 2005, Barber filed a petition for writ of mandamus in the Circuit Court of Fairfax County ("trial court") seeking an order to require (1) that VistaRMS provide Barber the opportunity to inspect and copy various records concerning the financial reports and stock history of VistaRMS as well as documents relating to the sale of VistaRMS; (2) that VistaRMS provide Barber with notice of his dissenting rights; and (3) that VistaRMS be prohibited from directly or indirectly distributing assets to its shareholders. VistaRMS filed a demurrer to the petition contending that Barber was not a shareholder and, thus, had no legal right to the relief requested. The trial court sustained VistaRMS's demurrer, but granted Barber leave to file an amended petition.
Barber subsequently filed an amended petition for writ of mandamus that contained substantially similar allegations to those in the original petition. Specifically, Barber asserted a continuing ownership interest in VistaRMS, citing the terms of the stock certificates stating that the shares of stock could only be transferred on the books of the corporation upon the endorsement and presentation of the certificates. Barber further asserted that the termination provisions in the 1998 Agreement and the 1999 and 2002 Addenda were void because they lacked material terms and contravened several Virginia statutes. Additionally, Barber contended that VistaRMS waived any right to terminate Barber's interest in the shares through a provision in the Separation Agreement releasing Barber "from any and all legal claims and causes of action whatsoever . . . arising out of [Barber's] entire employment relationship with VistaRMS, and the termination thereof."
*711 VistaRMS filed a demurrer to the amended petition for writ of mandamus. VistaRMS principally contended that Barber would only be entitled to inspect and copy records if he were a shareholder of VistaRMS, which VistaRMS maintained was disproved by the "clear and unambiguous documents attached to Barber's Amended Petition."
After briefing and oral argument by the parties, the trial court sustained VistaRMS's demurrer to Barber's amended petition for writ of mandamus, ruling that, under the 1998 Agreement, the 1999 and 2002 Addenda, and the Separation Agreement, Barber was no longer a shareholder in VistaRMS and, thus, did not have standing to obtain the requested relief. On July 11, 2005, the trial court entered a final order sustaining VistaRMS's demurrer to Barber's amended petition for writ of mandamus and dismissing the petition with prejudice. This appeal followed.

DISCUSSION
Barber has assigned error to the trial court's judgments sustaining the demurrers to both his original petition for writ of mandamus and his amended petition for writ of mandamus. However, "[w]hen a circuit court sustains a demurrer to an amended pleading which is complete in itself and fails to incorporate by reference allegations in earlier pleadings, we will consider only the allegations contained in the amended pleading that was the subject of the demurrer sustained by the judgment appealed from." Delk v. Columbia/HCA Healthcare Corp., 259 Va. 125, 129, 523 S.E.2d 826, 829 (2000); see also Bell Atlantic-Virginia, Inc. v. Arlington County, 254 Va. 60, 63 n. 2, 486 S.E.2d 297, 299 n. 2 (1997); Norfolk & W. Ry. Co. v. Sutherland, 105 Va. 545, 549-50, 54 S.E. 465, 466 (1906). Accordingly, although we have noted that the allegations of both the original and amended petitions were not substantially different and the trial court's basis for sustaining the demurrers was the same in each instance, we will limit our consideration to the trial court's final judgment sustaining the demurrer to the amended petition for writ of mandamus.
Under familiar principles, a demurrer tests only the sufficiency of factual allegations made in a pleading to determine whether the pleading states a cause of action. See Fun v. Virginia Military Institute, 245 Va. 249, 252, 427 S.E.2d 181, 183 (1993). In this case, we need not determine whether Barber's allegations support the issuance of a writ of mandamus. Rather, we need only to determine whether the trial court correctly ruled based on those allegations that Barber was not a shareholder of VistaRMS and, consequently, did not have standing to seek the relief requested in the amended petition for writ of mandamus.
Barber does not dispute that any entitlement he may have to the relief requested in the petition depends on his status as a shareholder at the time he made his demand to VistaRMS and subsequently when he filed his petition. See Code § 13.1-724 and Code § 13.1-771 (referencing rights of a "shareholder"). Barber makes several contentions in support of his assertion that he was a shareholder during the necessary time period.
Initially, Barber asserts shareholder status based on the fact that he "remained a shareholder of record on the books of VistaRMS both on the date of his termination and thereafter." See Code § 13.1-603 (defining "shareholder" as "the person in whose name shares are registered in the records of the corporation"). Furthermore, Barber contends that his continued possession of the two stock certificates evidencing his shares of VistaRMS common stock is prima facie evidence that he presently owns the shares. See Code § 8.8A-114(3) (providing that in an action on a certificated security against the issuer, production of the certificate entitles a holder to recover on it unless the defendant establishes a defense or defect going to the validity of the security).
We agree with Barber that possession of stock certificates and registration of the certificates in the records of a corporation are prima facie evidence of shareholder status. See Code § 8.8A-114(3); Code § 13.1-661(B); Young v. Young, 240 Va. 57, 62, 393 S.E.2d 398, 400 (1990) ("The ownership of stock as reflected in the corporate *712 records is prima facie correct."). However, possession of certificates and recordation of them in the corporation's records is not dispositive of the issue of true ownership. See Young, 240 Va. at 62, 393 S.E.2d at 400 ("Neither the corporation's records nor the outstanding stock certificates . . . are a verity."). As we explained in Swan v. Swan, 136 Va. 496, 117 S.E. 858 (1923):
[I]t is quite possible and often happens, for reasons of convenience or otherwise, that stock held in the name of one person really belongs to another. In such a case the certificate, though prima facie evidence of ownership in the person to whom it has been issued, possesses no such magic or sacredness as to prevent an inquiry into the facts.
Id. at 519, 117 S.E. at 865; see Young, 240 Va. at 62, 393 S.E.2d at 400.
VistaRMS contends that the true ownership of the shares in question is governed by the 1998 Agreement, the 1999 and 2002 Addenda, and the Separation Agreement, which were attached by Barber to the amended petition for writ of mandamus. According to VistaRMS, the plain language in the 1998 Agreement and the Addenda stating that Barber's ownership of the stock would "immediately cease" in the event of his termination, and the language in the Separation Agreement that Barber's right to "all employee benefits . . . including . . . stocks . . . are terminated," effectively trumps the fact that Barber remained in possession of the certificates and was listed as a shareholder in VistaRMS' corporate records. We agree.
It is axiomatic that when the terms in a contract are clear and unambiguous, the contract is construed according to its plain meaning. City of Chesapeake v. States Self-Insurers Risk Retention Group, Inc., 271 Va. 574, 578, 628 S.E.2d 539, 541 (2006). Additionally, "`[w]ords that the parties used are normally given their usual, ordinary, and popular meaning. No word or clause in the contract will be treated as meaningless if a reasonable meaning can be given to it, and there is a presumption that the parties have not used words needlessly.'" Id. (quoting D.C. McClain, Inc. v. Arlington County, 249 Va. 131, 135-36, 452 S.E.2d 659, 662 (1995)). Furthermore, "`parties may contract as they choose so long as what they agree to is not forbidden by law or against public policy.'" Coady v. Strategic Resources, Inc., 258 Va. 12, 17, 515 S.E.2d 273, 275 (1999) (quoting Chesapeake and Potomac Telephone Co. v. Sisson & Ryan, Inc., 234 Va. 492, 503, 362 S.E.2d 723, 729 (1987)); see also Ulloa v. QSP, Inc., 271 Va. 72, 79-80, 624 S.E.2d 43, 48 (2006); Atlantic Greyhound Lines v. Skinner, 172 Va. 428, 439, 2 S.E.2d 441, 446 (1939) (recognizing "the utmost liberty of contracting" and stating that "contracts, when entered into freely and voluntarily, shall be held sacred, and shall be enforced by courts of justice"); Code § 8.1A-302 (generally permitting parties to contractually vary the provisions of the Uniform Commercial Code).
The 1998 Agreement and the 1999 and 2002 Addenda clearly manifest the intent by the original shareholders in VistaRMS to allocate a limited ownership interest in the corporation to specific employees in the form of shares of common stock. In order to serve the expressly stated purpose of maintaining the closely held character of VistaRMS, these contracts unambiguously provide that the consequence of an employee-shareholder's termination of employment would be that his ownership of shares would "immediately cease." Without question, this language contemplates the automatic and instantaneous divestiture of Barber's ownership of the shares at the end of his employment. Equally clear are the terms in the Separation Agreement providing that Barber's rights to "all employee benefits . . . including . . . stock . . . terminated" on the date his employment ended.
Barber contends that, in spite of the plain language in the agreements providing that his ownership would cease upon the termination of his employment with VistaRMS, neither the 1998 Agreement nor the 1999 and 2002 Addenda specify how the shares would transfer from Barber to the original shareholders according to the reallocation provisions set forth in those documents. Conversely, Barber contends, the stock certificates expressly provide that the shares are "transferable only on the books of the *713 [c]orporation by the holder thereof in person or by Attorney upon surrender of this [c]ertificate properly endorsed." When construed together with the 1998 Agreement and the Addenda, Barber maintains that the language printed on the stock certificate establishes the requirements for transfer applicable to ownership of the shares distributed according to the parties' agreements and, since these requirements were not met, his ownership of the shares was never transferred. We disagree.
The boilerplate language on the stock certificates does not negate the clear terms of the parties' agreements that were specifically designed to govern ownership of the stock in the event of the termination of Barber's employment with VistaRMS. Unlike a circumstance in which the transfer of ownership of stock is attended by surrender of the endorsed certificate to the transferee or the corporation, here the parties' agreements clearly indicate that the divestiture of Barber's ownership of the stock in question did not require any procedure beyond his termination as an employee.
Barber next contends that, by the terms of the Separation Agreement, VistaRMS surrendered its right to assert ownership of the stocks by releasing Barber "from any and all legal claims and causes of action . . . arising out of [Barber's] entire employment relationship with VistaRMS, and the termination thereof." Barber asserts that by agreeing to this provision VistaRMS waived any right to reclaim the shares it had allocated to Barber. Again, we disagree.
Because the terms of the parties' agreements immediately ended Barber's ownership of the shares upon termination of his employment, VistaRMS was not required to make demand on Barber for the return of the certificates or to file a legal claim to regain ownership of the shares. Therefore, the release provision in the Separation Agreement simply did not affect either parties' ownership interest in the shares of stock.
We turn now to consider Barber's various statutory assertions. Barber initially notes that, pursuant to Code § 8.8A-104(a)(1), certificated shares of stock must be "delivered" in accordance with Code § 8.8A-301 in order for a transfer in ownership of the stock to occur. Barber asserts that, because he retains possession of the certificates, he retains ownership of the shares subject to VistaRMS's right to demand delivery. However, by its express terms Code § 8.8A-104(a)(1) applies only to "a purchaser to whom a security is delivered pursuant to § 8.8A-301." No sale or purchase of stock occurred in this case. Therefore, Code § 8.8A-104(a)(1) is inapplicable in this case.
Barber further contends that the termination provisions in the 1999 and 2002 Addenda violate Code § 13.1-638(A), which requires that shares of stock within the same class have identical preferences, limitations, and rights unless otherwise specified in the articles of incorporation of the corporation. According to Barber, the fact that the termination provisions apply only to the shares of common stock issued to Barber and the other employees and not to the shares of common stock owned by the original shareholders creates a variation within the class of common stock. This assertion is without merit. The termination provisions have no impact on the quality of the stock or the rights of the shareholder possessing it during the term of employment. Rather, the termination provisions in the Addenda address the ownership of the shares upon the termination of the shareholder's employment. Accordingly, Code § 13.1-638(A) is also inapplicable in this case.
Barber next contends that the termination provisions in the 1999 and 2002 Addenda are unenforceable under Code § 13.1-649(C)(3) because they do not serve a "reasonable purpose," because they "work a forfeiture in contravention of public policy," and because VistaRMS acted in "bad faith." We disagree with these assertions.
Code § 13.1-649(C)(3) provides that a restriction on transfer of shares is authorized for "any reasonable purpose." By its plain language, Code § 13.1-649(C)(3) applies solely to restrictions on transfer of stock. Although the 1998 Agreement and the Addenda contained consent restraints on transfer *714 of shares by the employee-shareholders, those provisions bear no impact on whether Barber's shareholder status continued following termination of his employment. Thus, Code § 13.1-649(C)(3) does not apply to the issue presented in this case.
Furthermore, we find no merit to Barber's contention that the termination provisions in the 1999 and 2002 Addenda are void because they violate public policy. The 1998 Agreement and the Addenda clearly and expressly indicate that the original shareholders intended to keep VistaRMS a closely held corporation with ownership confined to the three original shareholders and certain employees of VistaRMS. The termination provisions governing not only Barber's but also the rest of the employee-shareholders' stock allocations were tailored to this purpose by providing that when the employees left VistaRMS, their ownership in the company would cease. We simply do not see how such a provision violates any public policy of this Commonwealth. We also find no evidence in the record to support Barber's assertion that VistaRMS acted in "bad faith."
Barber's final argument is based on his assertion that the 1998 Agreement and the 1999 and 2002 Addenda do not meet the requirements for a shareholder agreement set forth in Code § 13.1-671.1.[5] As a consequence, Barber contends, the 1998 Agreement and the Addenda are not exempt from the requirements set forth in Code §§ 13.1-638, -639, -649, -710[6], or "the remainder of Chapter 9 of the Code." We need not determine whether the 1998 Agreement and the Addenda meet the criteria for a shareholder agreement under Code § 13.1-671.1. The sole impact of such a determination in Barber's favor would be to subject these agreements to the statutory provisions previously addressed. Since we have already determined that the relevant provisions in the 1998 Agreement and the Addenda do not contravene the Code sections upon which Barber relies, we need not determine whether the 1998 Agreement and the Addenda constitute shareholder agreements under Code § 13.1-671.1.

CONCLUSION
For the foregoing reasons, we hold that the trial court did not err in sustaining VistaRMS' demurrer to Barber's amended petition for writ of mandamus because Barber's ownership of shares of stock in VistaRMS ceased immediately upon the termination of his employment and, thus, Barber was not a shareholder of VistaRMS and lacked the necessary standing when he filed his amended petition for writ of mandamus. Accordingly, the judgment of the trial court will be affirmed.
Affirmed.
NOTES
[1]  Barber alleged in his amended petition for writ of mandamus that he is the "record owner of eight shares of common stock of VistaRMS." This assertion corresponds to the stock certificates issued to Barber in 1999 denoting two shares, and in 2002 denoting six shares. However, the 2002 Addendum stated, "It is the desire of the Corporation to transfer to Barber four shares of common stock," not six shares. In a memorandum filed in the trial court, VistaRMS stated that the 1999 certificate bearing two shares became void when the second certificate bearing six shares was issued. Our determination of the exact number of shares allocated to Barber is unnecessary in this appeal, however, given that neither party contends that Barber possessed shares not issued under either the 1999 or 2002 Addenda.
[2]  The stock certificates provided that the shares were "[f]ully [p]aid and [n]on-[a]ssessable" and "transferable only on the books of [VistaRMS] by the holder . . . upon surrender of this [c]ertificate properly endorsed."
[3]  The 1998 Agreement, the 1999 and 2002 Addenda, the Separation Agreement, and the stock certificates were appended to Barber's amended petition for writ of mandamus as exhibits.
[4]  The sale of VistaRMS to this corporation has since been effectuated.
[5]  Code § 13.1-671.1(A) provides that "[a]n agreement among the shareholders of a corporation that complies with [the requirements set forth in Code § 13.1-671.1] is effective among the shareholders and the corporation, even though it is inconsistent with one or more other [statutory] provisions."
[6]  Code § 13.1-710 imposes filing requirements upon a corporation amending its articles of incorporation. Since no amendment to VistaRMS' articles of incorporation is at issue in this case, Code § 13.1-710 is inapplicable.
