added tree container algorithm