change variables to scope