CPK Refactoring - mainly code cleanup