tuned a bit
added scan-based treebuild. it is slower