updates to CD algorithm