update tree insertion functionatlity