implemented scope indexing for local variables/parameters