Factor out CCM mode in a separate module