cda generation refactored