Replace getParent() by findAncestorWithClass() method

Added support to use findAncestorWithClass() in spite of getParent(). Issue #138