First version, basic tree walking