perf(scope): Make the digest loop easier to optimize by splitting it into smaller
and simpler methods.