better recursion control to filter hierarchy