Speed up CPD algorithm a bit