Amended and Restated Stock Purchase Agreement