Extracted vars from loop.
Optimised loop.