implement basic tree
fix some processing bugs; add tree nodes