factors out cohort creation into two different functions (leaving old one in place for legacy code)