Refactored CBD generation.