make searchTrials function more flexible...