updated trialfun to maximize the length of a word when >2400 samples