use a function as an scope for variables