Code cleanup and formatting fixes.