db new tree logic