improved scoping and associate caching