Despite trading in the red for most of today's session, stocks managed to end slightly higher as an upbeat consumer confidence report helped drive a positive finish. The Dow Jones Industrial Average (DJINDICES:^DJI) ended up just six points, or 0.03%, while the S&P 500 added 0.2% and the Nasdaq improved 0.4%, as tech stocks outperformed today.

Even as concerns about the simmering conflict in Iraq washed over the market earlier in the week, the Dow and S&P still finished near record highs. The University of Michigan this morning reported consumer confidence increasing to 82.5, up from 81.2 in May, and better than expectations of 81.7. The reading marked the sixth straight month the index has been higher than 80, indicating that consumer perception of the economy is stable and mostly favorable. This month's report also revealed a post-recession high in households reporting improved finances, yet another sign that the economy is on its way toward full health. 

Among stocks making headlines today was KB Home (NYSE:KBH), which finished the day up 4.5% on a strong earnings report. The home builder said home-sales prices grew 10% in the quarter, to $319,700, and posted a per-share profit of $0.27, much better than the $0.04-loss it saw a year ago, and better than analyst estimates at $0.20. Revenue in the quarter increased 8%, to $565 million, topping expectations at $557.2 million, and its backlog grew 24%, to $1.03 billion. Concerns about a flattening housing market have caused some pessimism on Wall Street, but the report from KB, which is one of the largest home builders in the country, seems to indicate that the housing sector is still headed in the right direction.

Moving in the opposite direction today was Dollar General (NYSE:DG). Shares of the company fell 7.3% after the retailer's CEO made a surprise retirement announcement. CEO Rick Dreiling said he would retire by May 30 of next year, or when a successor is named, leaving the company without the chief who guided sales up more than 80%, and store count up 38%. Since going public in 2009, the dollar store's shares have more than doubled, and shares had recently spiked on hopes that the chain would acquire Family Dollar, as activist investor Carl Icahn has been pushing for. Dreiling's retirement seemed to convince the market that a merger was less likely and, according to a Wells Fargo analyst, Dollar General is unlikely to pursue the acquisition while the company is dealing with a leadership transition. Indeed, shares may have fallen as much because of Dreiling's retirement, and because of the dimming possibility of the merger, which had sent Dollar General shares up by 7% in one day earlier in June.