Add flag to control the number of trials.
Minor code clean-up
Increase the possible loop decrementors.