refactor inheritanceIterator