Added CP class that can be used for both problems. Ex A working now,
will do ex B soonish.