Improve scope management