added explicit support for variable scopes