Chnaged variable scopes