Guard nModified assert based on writeMode()
Cap the number of threads
Only guard nModified
CR changes
Use Array.sum