made polygon implementation more clean in CM