Performance improvements

Improved performance with large documents (over ≈1,000 words) with many
errors.