revamped cohorts script to allow for general set of control/measurement variables