refactor: buildParents