implement filters and improve tree traversal