The stock market climbed to new record highs on Monday, spurred by big gains in the oil patch and ongoing optimism about the financial industry. The Dow, S&P 500, and Nasdaq all reached new all-time high levels, along with the small-cap Russell 2000 and mid-cap S&P Midcap 400 indexes. Some stocks did even better, and Marathon Petroleum (MPC 0.77%), Arista Networks (ANET 3.33%), and Headwaters (HW) were some of the best performers today. Below, we'll look more closely at these stocks to tell you why they did so well.

Image source: Marathon Petroleum.

Marathon gets some activist attention

Marathon Petroleum jumped 9% after activist investor Paul Singer and his Elliott Management private equity company asked the energy company to break itself into three different pieces. Elliott Management, which has about a 4% stake in Marathon Petroleum, sent a letter to the board of directors suggesting that a strategic review might lead the company to split out its retailing business into one entity, its refinery assets into another, and its pipeline and storage assets into a third separately traded investment vehicle. Marathon Petroleum issued a statement responding to the letter, saying that it has already taken action along the same lines that Singer's company has suggested but remains open to engaging with shareholders. Elliott has a history of successfully persuading companies to take actions to boost their share prices, and investors are hopeful that its efforts can lead to strong returns for Marathon as well.

Arista gets some trade relief

Arista Networks finished up more than 7% after the networking equipment company got a vote of approval from U.S. customs authorities. Arista has been working to find ways around an order from the International Trade Commission, which prevented it from importing products that rival Cisco Systems (CSCO -0.99%) had argued infringed on its intellectual property. However, Arista always believed that it could offer alternative designs that accomplished the same purpose while avoiding any infringement issues, and the U.S. Customs and Border Protection apparently agree that the design changes effectively limit the scope of the import ban. Further litigation is possible, but for now, investors are pleased that the solution appears to be taking shape.

Headwaters agrees to a merger

Finally, Headwaters jumped 17%. The building products company said Sunday that Australian peer Boral had agreed to buy Headwaters in a cash deal worth about $2.6 billion, with investors in Headwaters receiving $24.25 per share in cash. Boral believes that the deal will be completed around mid-2017, and Boral CEO Mike Kane said that Headwaters' businesses "are highly complementary with Boral's existing U.S. operations." Some question whether an expected commercial building boom in the U.S. will actually come to pass, but shareholders in Headwaters are benefiting from the current optimism.