Modified CA to be more generic