Refactored to limit scope of the variable.