improved publications connectToParent algorithm