Code cleanup and reorganization for quality control.