Formatting cleanup and code consolidation.