clean up code for CDS