subtree evaluation implementation