Added a loop for defining study.