Refactored the whole CDA module