Extend scopes to contain functions.