added all the major logic for the experiment