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.
Well I never knew you could do that within a for loop definition! Learning everyday for much win. Cheers!