Extracting method call from loop to a variable.