Added option to limit thread tasks to curb memory consumption