count and store trial index
count and store trial index