moved scope next to where it is called