Working version of local integration.