move variable to local scope for template rendering