Implement tree filter and recursive filter, see #4