working on traverse tree func