Make getParentHierarchy less recursive to preven StackOverflowExceptions