Optimize scope lookup