For loop optimization

The for loop was not optimized. It was calculating the length of `resolvers` on every iteration of the loop, so I moved it into the first statement, effectively caching the length and preventing this from being unnecessarily called too many times.