CPK Refactoring, minor code cleanup