Improved scoping