Code cleanup and consolidation.