implemented polynomial CAP and mask_CAP