implement Carma algorithm--step2