Change recursive functions to use utils/walk-tree