Cohorts function corrected