add new script options to specify max number of terms/patterns