Improved BSP tree code