general tree implemented