Exhibit 5 STOCK PURCHASE AGREEMENT dated as of July 24, 1997