Refactor to use function instead of variable.