More refactoring and CPT learning work-in-progress.