Rewrote pad_cv to fix numerous bugs.