The using of the XoopsTree class generates a lot of queries to the database. Most modules are using it directly or by XoopsTopic I have re-writen it to make only one query when it's intanciated. I've preserved all the methods with the same return (checked) The code is also shorter & faster than the original one.
If you want to have a look to the code: http://www.moflus.com/modules/newbb/viewtopic.php?topic_id=15&post_id=58#forumpost58