prune and graft with path
simplification of get_next
removing prints
is_leaf with path