changed the queries to pull from flat_table_cohort