Working code gen with scope.