Refactoring CDP1 code to use CDP2

Some recent posts on this topic:

1 2

Each of those also link to other resources.