Implement BSP tree