A simple recursive tree walker