Added tree authorization algorithm