better tree querying