LPIS: refactor connectExistingTouchingNodes and related code