some tries on generating tree structure