finish exercise: cm with termination.