Modified algorithm to assign stimuli...WIP