Reduce number of progress bar updates.
Merge branch 'MaskingOptimize'