better implementation of generic cdc