Exhibit 10.40 AMENDED AND RESTATED CREDIT AGREEMENT